Skip to content

Commit

Permalink
test: use external js-reactivity-benchmark package
Browse files Browse the repository at this point in the history
  • Loading branch information
divdavem committed Mar 4, 2025
1 parent 56cdb73 commit e83d672
Show file tree
Hide file tree
Showing 20 changed files with 636 additions and 1,152 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 #v1.20.4
with:
name: Tansu benchmarks
tool: 'customBiggerIsBetter'
tool: 'customSmallerIsBetter'
output-file-path: benchmarks.json
auto-push: ${{ github.event_name == 'push' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ dist
temp
coverage
.angular
benchmarks.json
*benchmarks.json
22 changes: 22 additions & 0 deletions benchmarks/js-reactivity-benchmark/adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { ReactiveFramework } from 'js-reactivity-benchmark';
import { writable, computed, batch } from '../../src/index';

export const tansuFramework: ReactiveFramework = {
name: '@amadeus-it-group/tansu',
signal: (initialValue) => {
const w = writable(initialValue);
return {
write: w.set,
read: w,
};
},
computed: (fn) => {
const c = computed(fn);
return {
read: c,
};
},
effect: (fn) => computed(fn).subscribe(() => {}),
withBatch: batch,
withBuild: (fn) => fn(),
};
18 changes: 18 additions & 0 deletions benchmarks/js-reactivity-benchmark/js-reactivity-benchmark.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { writeFile } from 'fs/promises';
import {
runTests,
formatPerfResultStrings,
formatPerfResult,
perfResultHeaders,
} from 'js-reactivity-benchmark';
import { tansuFramework } from './adapter';

(async () => {
console.log(formatPerfResultStrings(perfResultHeaders()));
const results: { name: string; value: number; unit: string }[] = [];
await runTests([{ framework: tansuFramework, testPullCounts: true }], (result) => {
console.log(formatPerfResult(result));
results.push({ name: result.test, value: result.time, unit: 'ms' });
});
await writeFile('js-reactivity-benchmarks.json', JSON.stringify(results, null, ' '));
})();
94 changes: 0 additions & 94 deletions benchmarks/js-reactivity-benchmarks/cellxBench.bench.ts

This file was deleted.

Loading

0 comments on commit e83d672

Please sign in to comment.