Closed jonkoops closed 9 months ago
Closes #239
main
This yields similar performance as before, which is to be expected. The following benchmarks were ran on my 2021 MacBook Pro 14-inch with an M1 Pro chip running macOS Sonoma (14.2.1):
@JedWatson @dcousens Since this is a breaking change, can I ask for one of you to do a review of the changes here?
If there are no objections to landing this I will merge this in a couple of days.
Closes #239
Benchmarks (compared to
main
)This yields similar performance as before, which is to be expected. The following benchmarks were ran on my 2021 MacBook Pro 14-inch with an M1 Pro chip running macOS Sonoma (14.2.1):
Node.js (v21.6.0)
``` Benchmarking 'strings'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | ---------- | ------------------ | ------ | ------- | | default/local | 14,162,314 | 70.60992962016418 | ±0.52% | 7081158 | | default/main | 14,178,179 | 70.53091545874804 | ±0.60% | 7089091 | | bind/local | 12,292,024 | 81.35356124369197 | ±0.19% | 6146013 | | bind/main | 11,954,301 | 83.6518950249842 | ±0.61% | 5977151 | | dedupe/local | 4,765,359 | 209.84777603384617 | ±1.08% | 2382680 | | dedupe/main | 4,746,307 | 210.69010818495897 | ±1.21% | 2373154 | Benchmarking 'object'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | ---------- | ------------------ | ------ | ------- | | default/local | 14,994,632 | 66.69053035940951 | ±0.80% | 7497317 | | default/main | 15,101,370 | 66.21915479019783 | ±0.44% | 7550686 | | bind/local | 12,106,443 | 82.60064078243907 | ±0.87% | 6053222 | | bind/main | 11,972,625 | 83.52387137087625 | ±1.11% | 5986313 | | dedupe/local | 9,176,647 | 108.97225349089068 | ±1.23% | 4588325 | | dedupe/main | 8,984,559 | 111.30206665699596 | ±1.64% | 4492280 | Benchmarking 'strings, object'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | ---------- | ------------------ | ------ | ------- | | default/local | 11,916,945 | 83.91412178935641 | ±0.51% | 5958473 | | default/main | 11,686,726 | 85.56716353792388 | ±0.72% | 5843364 | | bind/local | 9,995,353 | 100.04648479718055 | ±0.95% | 4997677 | | bind/main | 9,973,542 | 100.26527681594845 | ±1.03% | 4986772 | | dedupe/local | 4,681,457 | 213.6086911378063 | ±1.78% | 2340729 | | dedupe/main | 4,638,017 | 215.60938487026064 | ±1.87% | 2319009 | Benchmarking 'mix'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 7,902,016 | 126.54997622127121 | ±1.64% | 3951009 | | default/main | 8,134,794 | 122.9287325718794 | ±0.47% | 4067398 | | bind/local | 6,946,306 | 143.9613938808826 | ±0.59% | 3473154 | | bind/main | 6,871,004 | 145.5391251297498 | ±0.73% | 3435503 | | dedupe/local | 4,521,843 | 221.14875833842632 | ±1.06% | 2260922 | | dedupe/main | 4,554,670 | 219.55486629887875 | ±1.17% | 2277336 | Benchmarking 'arrays'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 5,105,027 | 195.8853357876707 | ±1.05% | 2552514 | | default/main | 5,067,386 | 197.34038008867017 | ±1.11% | 2533694 | | bind/local | 4,173,285 | 239.61933785476344 | ±0.35% | 2086643 | | bind/main | 4,157,391 | 240.53546261850187 | ±0.43% | 2078696 | | dedupe/local | 2,415,320 | 414.0236738610724 | ±0.24% | 1207661 | | dedupe/main | 2,331,170 | 428.96905161613597 | ±0.82% | 1165586 | ```Chrome (v120.0.6099.234)
``` Benchmarking 'strings'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 5,913,539 | 169.10346758339688 | ±2.79% | 2957361 | | default/main | 6,046,902 | 165.3739216246565 | ±2.77% | 3024056 | | bind/local | 5,650,193 | 176.9850746458846 | ±2.77% | 2825662 | | bind/main | 5,705,857 | 175.258479972447 | ±2.77% | 2852929 | | dedupe/local | 3,442,439 | 290.4916691996577 | ±2.77% | 1721564 | | dedupe/main | 3,451,537 | 289.72591349455683 | ±2.77% | 1725769 | Benchmarking 'object'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 6,215,576 | 160.8861121832988 | ±2.78% | 3108410 | | default/main | 6,222,135 | 160.71651280093076 | ±2.79% | 3111068 | | bind/local | 6,114,371 | 163.54911722259592 | ±2.77% | 3057797 | | bind/main | 5,820,813 | 171.79728263009576 | ±2.77% | 2910989 | | dedupe/local | 5,149,798 | 194.1823722197528 | ±2.78% | 2575414 | | dedupe/main | 5,191,831 | 192.61025212972848 | ±2.78% | 2596435 | Benchmarking 'strings, object'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 5,730,025 | 174.51927792754816 | ±2.77% | 2865013 | | default/main | 5,691,037 | 175.71487596928526 | ±2.77% | 2846088 | | bind/local | 5,203,827 | 192.1662284081456 | ±2.78% | 2601914 | | bind/main | 5,278,964 | 189.43110063398484 | ±2.78% | 2640010 | | dedupe/local | 3,495,348 | 286.09447005916945 | ±2.78% | 1748024 | | dedupe/main | 3,546,667 | 281.95478123051066 | ±2.78% | 1773334 | Benchmarking 'mix'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 4,740,017 | 210.9696631412994 | ±2.79% | 2370483 | | default/main | 4,791,901 | 208.68540300874866 | ±2.78% | 2395951 | | bind/local | 4,215,125 | 237.24083218478532 | ±2.82% | 2107563 | | bind/main | 4,398,946 | 227.32717155486904 | ±2.80% | 2199913 | | dedupe/local | 3,356,956 | 297.8888667420629 | ±2.80% | 1678814 | | dedupe/main | 3,318,958 | 301.29936479687365 | ±4.90% | 1659811 | Benchmarking 'arrays'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 3,702,189 | 270.11042606579235 | ±2.77% | 1851465 | | default/main | 3,658,242 | 273.3553175932221 | ±2.77% | 1829487 | | bind/local | 3,158,695 | 316.5863381668738 | ±2.77% | 1579348 | | bind/main | 3,158,952 | 316.5606611453766 | ±2.77% | 1579792 | | dedupe/local | 2,014,319 | 496.44566345232846 | ±2.77% | 1007361 | | dedupe/main | 2,001,151 | 499.71216583159656 | ±2.77% | 1000576 | ```Firefox (v121.0.1)
``` Benchmarking 'strings'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | ---------- | ------------------ | ------ | ------- | | default/local | 10.168.850 | 98.33953691912065 | ±8.76% | 5084425 | | default/main | 10.569.190 | 94.6146298817601 | ±8.76% | 5284595 | | bind/local | 10.652.710 | 93.87282672672025 | ±8.76% | 5326355 | | bind/main | 9.729.718 | 102.77790168224814 | ±8.76% | 4864859 | | dedupe/local | 3.604.548 | 277.4272946288966 | ±8.76% | 1802274 | | dedupe/main | 3.510.374 | 284.869931238096 | ±8.76% | 1755187 | Benchmarking 'object'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 9.545.386 | 104.76265705755638 | ±8.76% | 4772693 | | default/main | 9.558.920 | 104.61432881538919 | ±8.76% | 4779460 | | bind/local | 9.418.188 | 106.17753648578686 | ±8.76% | 4709094 | | bind/main | 9.356.470 | 106.87791442712903 | ±8.76% | 4678235 | | dedupe/local | 6.989.462 | 143.07252832907596 | ±8.76% | 3494731 | | dedupe/main | 6.868.028 | 145.60220197122086 | ±8.76% | 3434014 | Benchmarking 'strings, object'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 8.360.370 | 119.61193105089848 | ±8.76% | 4180185 | | default/main | 8.786.650 | 113.80901708842391 | ±8.76% | 4393325 | | bind/local | 8.182.256 | 122.21568232526579 | ±8.76% | 4091128 | | bind/main | 8.442.166 | 118.45301312483075 | ±8.76% | 4221083 | | dedupe/local | 3.883.008 | 257.53230485232064 | ±8.76% | 1941504 | | dedupe/main | 4.089.736 | 244.51456035303988 | ±8.76% | 2044868 | Benchmarking 'mix'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 6.151.468 | 162.56282240271753 | ±8.76% | 3075734 | | default/main | 5.903.986 | 169.37709540639153 | ±8.76% | 2951993 | | bind/local | 5.557.080 | 179.95062154944682 | ±8.76% | 2778540 | | bind/main | 5.731.634 | 174.47031684158478 | ±8.76% | 2865817 | | dedupe/local | 3.458.106 | 289.17563544900014 | ±8.76% | 1729053 | | dedupe/main | 3.400.154 | 294.10432586288744 | ±8.76% | 1700077 | Benchmarking 'arrays'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ----------------- | ------ | ------- | | default/local | 3.600.386 | 277.7479970203195 | ±8.76% | 1800193 | | default/main | 3.534.364 | 282.9363359291799 | ±8.76% | 1767182 | | bind/local | 3.346.828 | 298.790377037601 | ±8.76% | 1673414 | | bind/main | 3.467.382 | 288.4020278123379 | ±8.76% | 1733691 | | dedupe/local | 1.904.113 | 525.1786395142308 | ±8.76% | 952057 | | dedupe/main | 1.891.921 | 528.5630168685602 | ±8.76% | 945961 | ```Safari (v17.2.1)
``` Benchmarking 'strings'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 6,668,426 | 149.9604254437254 | ±8.76% | 3334213 | | default/main | 6,783,733 | 147.41144036603038 | ±8.76% | 3391867 | | bind/local | 6,903,501 | 144.85401756963455 | ±8.76% | 3451751 | | bind/main | 7,077,419 | 141.29444323643574 | ±8.76% | 3545787 | | dedupe/local | 2,642,675 | 378.404314414634 | ±8.76% | 1321338 | | dedupe/main | 2,595,483 | 385.2847377256777 | ±8.75% | 1300337 | Benchmarking 'object'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 5,156,147 | 193.9432304891206 | ±8.76% | 2578074 | | default/main | 5,271,834 | 189.68729613821242 | ±8.76% | 2641189 | | bind/local | 5,290,119 | 189.03163733091375 | ±8.76% | 2650350 | | bind/main | 5,246,455 | 190.60485783165143 | ±8.76% | 2623228 | | dedupe/local | 4,436,387 | 225.40859816589696 | ±8.76% | 2218194 | | dedupe/main | 4,349,109 | 229.93211265847165 | ±8.76% | 2178904 | Benchmarking 'strings, object'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 4,369,467 | 228.8608621887562 | ±8.76% | 2189103 | | default/main | 4,220,892 | 236.91673440782188 | ±8.76% | 2114667 | | bind/local | 4,372,055 | 228.72534696857858 | ±8.76% | 2190400 | | bind/main | 4,301,475 | 232.47839134231572 | ±8.76% | 2155039 | | dedupe/local | 2,373,947 | 421.2392183822116 | ±8.76% | 1186974 | | dedupe/main | 2,344,819 | 426.47196799755284 | ±8.76% | 1172410 | Benchmarking 'mix'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ------------------ | ------ | ------- | | default/local | 3,110,191 | 321.52355867420283 | ±8.76% | 1555096 | | default/main | 3,115,951 | 320.92920558468404 | ±8.76% | 1557976 | | bind/local | 3,243,699 | 308.2899158368687 | ±8.76% | 1621850 | | bind/main | 3,231,209 | 309.4815873929648 | ±8.76% | 1615605 | | dedupe/local | 2,352,005 | 425.1689855773422 | ±8.75% | 1178355 | | dedupe/main | 2,306,153 | 433.6224438129694 | ±8.75% | 1155383 | Benchmarking 'arrays'. | Task Name | ops/sec | Average Time (ns) | Margin | Samples | | ------------- | --------- | ----------------- | ------ | ------- | | default/local | 1,486,828 | 672.5725968954068 | ±8.75% | 744901 | | default/main | 1,484,003 | 673.8526311249933 | ±8.76% | 742002 | | bind/local | 1,467,479 | 681.4402922016171 | ±8.76% | 733740 | | bind/main | 1,424,365 | 702.06710416237 | ±8.75% | 713607 | | dedupe/local | 1,069,655 | 934.8799988033741 | ±8.76% | 534828 | | dedupe/main | 1,061,259 | 942.27616229766 | ±8.76% | 530630 | ```