TryGhost / node-sqlite3

SQLite3 bindings for Node.js
BSD 3-Clause "New" or "Revised" License
6.23k stars 817 forks source link

src: precompute field names #1772

Open gabrielschulhof opened 8 months ago

gabrielschulhof commented 8 months ago

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: https://github.com/nodejs/abi-stable-node/issues/458

gabrielschulhof commented 8 months ago

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% 👍
gabrielschulhof commented 7 months ago

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 commented 7 months ago

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

gabrielschulhof commented 5 months ago

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?