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

src: precompute field names #1772

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gabrielschulhof
Copy link

Field names do not change from row to row, so let's create JS strings only during the process of calling back into JS with the first row, not with each row. We save the JS strings we created while calling back with the first row, and re-use them when creating objects for subsequent rows.

Re: nodejs/abi-stable-node#458

@gabrielschulhof
Copy link
Author

gabrielschulhof commented Mar 24, 2024

select benchmark before and after (ran each 30 times before and 30 times after):

select
db.each db.all
baseline this PR baseline this PR
590.95 554.337 726.982 686.921
577.268 526.597 736.352 665.569
576.186 536.689 723.251 681.398
584.32 525.596 724.046 673.034
592.83 537.028 730.969 689.051
586.968 555.545 725.337 684.295
583.011 543.743 729.094 685.417
579.357 546.343 737.633 675.979
585.594 526.047 734.532 671.272
591.169 516.65 726.441 672.008
581.965 532.032 732.463 668.391
610.069 531.688 737.95 684.103
593.087 522.436 738.648 666.182
590.154 532.068 721.377 673.008
605.924 519.068 746.159 676.44
589.368 530.219 716.455 676.914
582.476 532.27 722.437 681.359
592.816 508.93 725.039 681.662
583.031 517.32 712.134 677.893
628.729 516.115 778.948 664.469
571.472 539.952 731.096 670.911
623.705 534.565 773.177 676.954
578.92 523.784 719.689 677.66
586.045 538.222 732.234 670.445
584.54 520.251 719.035 682.739
571.858 537.804 742.486 680.482
595.769 521.138 738.136 672.084
581.354 540.571 715.948 669.942
580.322 545.146 717.724 668.625
580.956 521.106 729.451 671.797
average 588.6737667 531.1086667 731.5074333 675.9001333
▼ 9.78% 👍 ▼ 7.60% 👍

Field names do not change from row to row, so let's create JS strings
only during the process of calling back into JS with the first row, not
with each row. We save the JS strings we created while calling back
with the first row, and re-use them when creating objects for
subsequent rows.

Re: nodejs/abi-stable-node#458
@gabrielschulhof
Copy link
Author

I don't get why the build fails. node-addon-api requires 16 or 18 or >= 20, and it's getting 18. The version of node should be satisfactory.

@gabrielschulhof
Copy link
Author

@daniellockyer can you please help me figure out why the tests are failing?

@gabrielschulhof
Copy link
Author

Why does tools/semver-check.js claim that the highest supported Node.js version is 10.12.0? That's why all the tests are failing. Can I change it to the current version of Node.js?

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

Successfully merging this pull request may close these issues.

1 participant