Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: QUnit.equiv major ES6 refactor & optimizations [Step 2] #1701

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

izelnakri
Copy link
Contributor

@izelnakri izelnakri commented Aug 17, 2022

This PR introduces further refactors and optimizations based on #1700

Certain changes probably require QUnit to update its browser policy and deprecate support for certain browsers.

I'm confident that each commit should result in faster deepEqual checks, except the last one. The last commit particularly needs to be benchmarked I think.

I seperated each refactor to its seperate commit. Have a look, I think you'll find it very interesting! :)

Krinkle pushed a commit to Krinkle/qunit that referenced this pull request Jun 11, 2024
Krinkle pushed a commit to Krinkle/qunit that referenced this pull request Jun 11, 2024
@Krinkle
Copy link
Member

Krinkle commented Jun 11, 2024

@izelnakri I believe most of these have landed since in commits at https://github.com/qunitjs/qunit/commits/main/src/equiv.js. Mainly fec7c1a.

The one part that I haven't landed yet is the passing down of pairs as local variable. I extracted that and rebased it on latest main at https://github.com/Krinkle/qunit/tree/equiv-pass-memory-pairs.

I did not see a consistent difference in the benchmark, though. Perhaps you'd like to have a look to check that 1) I've applied it correctly, or 2) perhaps benchmark it differently.

$ git co main && npx npm run benchmark && npx npm run benchmark && git co equiv-pass-memory-pairs && npx npm run benchmark && npx npm run benchmark

Switched to branch 'main'

> [email protected] benchmark
> npm install --silent --no-audit --prefix test/benchmark/ && node test/benchmark/index-node.js

Running benchmark...
QUnit.equiv x 881 ops/sec ±0.65% (97 runs sampled)
QUnit.equiv (primitives) x 1,961,320 ops/sec ±0.75% (94 runs sampled)
QUnit.equiv (small arrays) x 806,947 ops/sec ±0.80% (95 runs sampled)
QUnit.equiv (deep arrays) x 36,318 ops/sec ±0.27% (100 runs sampled)
QUnit.equiv (arrays) x 491,170 ops/sec ±0.31% (97 runs sampled)
QUnit.equiv (small objects) x 864,876 ops/sec ±0.31% (97 runs sampled)
QUnit.equiv (deep objects) x 54,588 ops/sec ±0.29% (100 runs sampled)
QUnit.equiv (objects) x 35,166 ops/sec ±0.40% (97 runs sampled)
QUnit.equiv (small sets) x 184,472 ops/sec ±0.30% (95 runs sampled)
QUnit.equiv (sets) x 1,173 ops/sec ±0.64% (98 runs sampled)
QUnit.equiv (maps) x 15,811 ops/sec ±0.76% (96 runs sampled)
QUnit.equiv (class trees) x 8,833 ops/sec ±0.38% (95 runs sampled)
Done!

Running benchmark...
QUnit.equiv x 878 ops/sec ±0.44% (96 runs sampled)
QUnit.equiv (primitives) x 1,931,424 ops/sec ±0.46% (93 runs sampled)
QUnit.equiv (small arrays) x 776,598 ops/sec ±0.53% (94 runs sampled)
QUnit.equiv (deep arrays) x 35,673 ops/sec ±0.32% (95 runs sampled)
QUnit.equiv (arrays) x 480,836 ops/sec ±0.32% (94 runs sampled)
QUnit.equiv (small objects) x 878,539 ops/sec ±0.43% (96 runs sampled)
QUnit.equiv (deep objects) x 53,662 ops/sec ±1.01% (91 runs sampled)
QUnit.equiv (objects) x 34,641 ops/sec ±0.52% (97 runs sampled)
QUnit.equiv (small sets) x 183,539 ops/sec ±0.81% (92 runs sampled)
QUnit.equiv (sets) x 1,167 ops/sec ±0.65% (96 runs sampled)
QUnit.equiv (maps) x 15,591 ops/sec ±0.91% (97 runs sampled)
QUnit.equiv (class trees) x 8,849 ops/sec ±1.14% (90 runs sampled)
Done!

Switched to branch 'equiv-pass-memory-pairs'

> [email protected] benchmark
> npm install --silent --no-audit --prefix test/benchmark/ && node test/benchmark/index-node.js

Running benchmark...
QUnit.equiv x 857 ops/sec ±1.01% (95 runs sampled)
QUnit.equiv (primitives) x 1,953,876 ops/sec ±0.59% (98 runs sampled)
QUnit.equiv (small arrays) x 798,372 ops/sec ±0.53% (95 runs sampled)
QUnit.equiv (deep arrays) x 36,255 ops/sec ±0.54% (97 runs sampled)
QUnit.equiv (arrays) x 483,717 ops/sec ±0.50% (95 runs sampled)
QUnit.equiv (small objects) x 880,828 ops/sec ±0.43% (97 runs sampled)
QUnit.equiv (deep objects) x 54,604 ops/sec ±0.41% (95 runs sampled)
QUnit.equiv (objects) x 34,886 ops/sec ±0.71% (96 runs sampled)
QUnit.equiv (small sets) x 188,855 ops/sec ±0.64% (91 runs sampled)
QUnit.equiv (sets) x 1,171 ops/sec ±0.29% (98 runs sampled)
QUnit.equiv (maps) x 15,976 ops/sec ±0.49% (99 runs sampled)
QUnit.equiv (class trees) x 8,663 ops/sec ±0.46% (97 runs sampled)
Done!

Running benchmark...
QUnit.equiv x 879 ops/sec ±0.52% (96 runs sampled)
QUnit.equiv (primitives) x 1,930,780 ops/sec ±0.42% (96 runs sampled)
QUnit.equiv (small arrays) x 792,460 ops/sec ±0.61% (94 runs sampled)
QUnit.equiv (deep arrays) x 37,194 ops/sec ±0.24% (100 runs sampled)
QUnit.equiv (arrays) x 497,235 ops/sec ±0.43% (99 runs sampled)
QUnit.equiv (small objects) x 871,458 ops/sec ±0.38% (96 runs sampled)
QUnit.equiv (deep objects) x 54,735 ops/sec ±0.51% (97 runs sampled)
QUnit.equiv (objects) x 34,923 ops/sec ±0.62% (93 runs sampled)
QUnit.equiv (small sets) x 186,754 ops/sec ±0.38% (92 runs sampled)
QUnit.equiv (sets) x 1,140 ops/sec ±0.41% (96 runs sampled)
QUnit.equiv (maps) x 15,947 ops/sec ±0.46% (95 runs sampled)
QUnit.equiv (class trees) x 9,022 ops/sec ±0.29% (97 runs sampled)
Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants