name | ops/sec | samples |
---|---|---|
Directly in the object | 90,089,393 | 45060451 |
Using dot notation | 68,577,012 | 34294399 |
Using define property (writable) | 4,412,085 | 2206462 |
Using define property initialized (writable) | 6,045,521 | 3023066 |
Using define property (getter) | 2,189,460 | 1094761 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 21:58:51 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.004ms |
new Array(length) | 10 | 0.002ms |
array.push | 100 | 0.108ms |
new Array(length) | 100 | 0.01ms |
array.push | 1,000 | 0.027ms |
new Array(length) | 1,000 | 0.015ms |
array.push | 10,000 | 0.253ms |
new Array(length) | 10,000 | 0.136ms |
array.push | 1,000,000 | 29.892ms |
new Array(length) | 1,000,000 | 6.314ms |
array.push | 100,000,000 | 1,891.71ms |
new Array(length) | 100,000,000 | 4,114.286ms |
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.006ms |
new Array(length) | 10 | 0.003ms |
array.push | 100 | 0.016ms |
new Array(length) | 100 | 0.013ms |
array.push | 1,000 | 0.035ms |
new Array(length) | 1,000 | 0.02ms |
array.push | 10,000 | 18.266ms |
new Array(length) | 10,000 | 5.231ms |
array.push | 1,000,000 | 165.476ms |
new Array(length) | 1,000,000 | 7.576ms |
array.push | 100,000,000 | 2,014.58ms |
new Array(length) | 100,000,000 | 4,719.61ms |
name | ops/sec | samples |
---|---|---|
new Array | 321 | 161 |
Array.from | 23 | 12 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:01:45 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
new Blob (128) | 5,302 | 2656 |
new Blob (1024) | 655 | 329 |
text (128) | 4,222 | 2116 |
text (1024) | 532 | 267 |
arrayBuffer (128) | 4,231 | 2116 |
arrayBuffer (1024) | 533 | 268 |
slice (0, 64) | 157,721 | 79259 |
slice (0, 512) | 32,687 | 16348 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:03:25 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
[True conditional] Using instanceof only | 454,543 | 227279 |
[True conditional] Using constructor name | 355,248 | 177625 |
[True conditional] Check if property is valid then instanceof | 349,599 | 174871 |
[False conditional] Using instanceof only | 97,461,125 | 48734473 |
[False conditional] Using constructor name | 97,033,887 | 49136340 |
[False conditional] Check if property is valid then instanceof | 98,735,233 | 49370107 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:04:48 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
crypto.createVerify('RSA-SHA256') | 6,771 | 3386 |
crypto.verify('RSA-SHA256') | 6,909 | 3455 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:05:42 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
new Date().toISOString() | 1,374,137 | 687136 |
fromUnixToISOString(new Date()) | 1,994,792 | 997499 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:07:07 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Intl.DateTimeFormat().format(Date.now()) | 18,420 | 9211 |
Intl.DateTimeFormat().format(new Date()) | 18,446 | 9224 |
Intl.DateTimeFormat(undefined, twoDigitsLocaleOptions).format(Date.now()) | 18,379 | 9190 |
Intl.DateTimeFormat(undefined, twoDigitsLocaleOptions).format(new Date()) | 18,109 | 9055 |
Reusing Intl.DateTimeFormat() | 476,467 | 238235 |
Date.toLocaleDateString() | 937,911 | 468956 |
Date.toLocaleDateString(undefined, twoDigitsLocaleOptions) | 22,327 | 11166 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:08:19 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Using String() | 868,752 | 434377 |
Using brackets {} | 895,435 | 447719 |
Using '' + | 1,010,711 | 505410 |
Using date.toString() | 1,172,828 | 587682 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:09:40 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Using delete property | 4,025,729 | 2012979 |
Using delete property (proto: null) | 15,874,867 | 7946781 |
Using delete property (cached proto: null) | 3,954,631 | 1977479 |
Using undefined assignment | 69,901,466 | 34953365 |
Using undefined assignment (proto: null) | 17,089,541 | 8546085 |
Using undefined property (cached proto: null) | 70,112,166 | 35056230 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:11:11 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Error | 419,699 | 209931 |
NodeError | 338,800 | 169403 |
NodeError Range | 330,638 | 165500 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:12:45 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Function returning null | 1,926,490 | 963453 |
Function returning explicitly undefined | 1,858,048 | 930461 |
Function returning implicitly undefined | 1,708,379 | 854225 |
Function returning string | 1,866,335 | 933451 |
Function returning integer | 1,733,730 | 866880 |
Function returning float | 1,858,100 | 929478 |
Function returning functions | 1,818,245 | 909586 |
Function returning arrow functions | 1,735,588 | 867868 |
Function returning empty object | 1,749,101 | 874652 |
Function returning empty array | 1,772,475 | 887711 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:13:46 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
using Array.includes | 92,192,714 | 46096460 |
using Array.includes (first item) | 82,169,994 | 41085002 |
Using raw comparison | 99,624,251 | 49812131 |
Using raw comparison (first item) | 99,706,392 | 49853202 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:15:20 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Using Object.keys() | 49,036,589 | 24521916 |
Using Object.getOwnPropertyNames() | 41,561,813 | 20812793 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:16:22 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Length = 100 - Array.at | 131,081,537 | 65540792 |
Length = 10_000 - Array.at | 97,857,346 | 49008243 |
Length = 1_000_000 - Array.at | 97,742,413 | 48871227 |
Length = 100 - Array[length - 1] | 98,712,758 | 49366822 |
Length = 10_000 - Array[length - 1] | 98,323,969 | 49162033 |
Length = 1_000_000 - Array[length - 1] | 96,703,460 | 48354152 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:17:41 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Math.floor (small) | 138,961,287 | 69483505 |
~ (small) | 96,156,888 | 48078872 |
Math.floor (long) | 98,592,829 | 49312884 |
~ (long) | 95,472,506 | 47741867 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:18:38 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Object.create(null) | 42,586,636 | 21306387 |
Object.create({}) | 1,952,616 | 983951 |
Cached Empty.prototype | 73,515,860 | 36758748 |
Empty.prototype | 2,397,832 | 1213550 |
Empty class | 1,509,930 | 754966 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:20:26 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Using optional chain (obj.field?.field2) (Valid) | 145,835,956 | 72918530 |
Using optional chain (obj.field?.field2) (undefined) | 99,021,733 | 49510872 |
Using and operator (obj.field && obj.field.field2) (Valid) | 98,400,632 | 49200342 |
Using and operator (obj.field && obj.field.field2) (undefined) | 98,924,022 | 49462695 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:21:46 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Using parseInt(x, 10) - small number (2 len) | 136,529,625 | 68267206 |
Using parseInt(x, 10) - big number (10 len) | 97,121,606 | 48561689 |
Using + - small number (2 len) | 92,679,462 | 46363940 |
Using + - big number (10 len) | 96,166,195 | 48083144 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:22:34 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Using if to check function existence | 962,415 | 481221 |
Using ? operator to avoid rejection | 1,025,993 | 515879 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:23:44 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Raw usage private field | 135,881,932 | 67942180 |
Raw usage underscore usage | 98,821,632 | 49410825 |
Manipulating private properties using # | 96,267,213 | 48133615 |
Manipulating private properties using underscore(_) | 98,311,292 | 49194032 |
Manipulating private properties using Symbol | 97,176,293 | 48588958 |
Manipulating private properties using PrivateSymbol | 35,622,437 | 17813540 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:24:49 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Adding property after object creation - small object | 8,077,968 | 4039040 |
Adding property in the object creation - small object | 7,528,168 | 3797190 |
Adding property after the function creation - small class | 249,619 | 125148 |
Adding property in the function creation - small class | 271,863 | 135932 |
Adding property after the class creation - small class | 258,211 | 129530 |
Adding property in the class creation - small class | 259,234 | 132556 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:26:52 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Getter (class) | 150,277,841 | 75171410 |
Getter | 51,307,048 | 25659764 |
Method | 100,763,960 | 50389402 |
DefineProperty (getter) | 98,660,471 | 49330276 |
DefineProperty (getter & enumerable=false) | 50,087,425 | 25044953 |
DefineProperty (getter & configurable=false) | 97,355,154 | 48677653 |
DefineProperty (getter & enumerable=false & configurable=false) | 51,476,272 | 25773810 |
DefineProperty (writable) | 99,292,951 | 49647351 |
DefineProperty (writable & enumerable=false) | 99,082,142 | 49541103 |
DefineProperty (writable & enumerable=false & configurable=false) | 98,473,294 | 49241307 |
DefineProperties (getter) | 49,285,533 | 24643112 |
DefineProperties (getter & enumerable=false) | 49,379,727 | 24695435 |
DefineProperties (getter & enumerable=false & configurable=false) | 51,477,071 | 25738748 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:28:10 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Setter (class) | 120,914,193 | 60467040 |
Setter | 10,922,153 | 5461549 |
Method | 80,219,166 | 40110265 |
DefineProperty (setter) | 82,091,910 | 41045961 |
DefineProperty (setter & enumerable=false) | 10,820,384 | 5410195 |
DefineProperty (setter & configurable=false) | 11,026,152 | 5513079 |
DefineProperty (setter & enumerable=false & configurable=false) | 10,865,002 | 5432505 |
DefineProperty (writable) | 57,544,427 | 28774877 |
DefineProperty (writable & enumerable=false) | 82,988,435 | 41494464 |
DefineProperty (writable & enumerable=false & configurable=false) | 82,750,662 | 41377334 |
DefineProperties (setter) | 79,515,602 | 39760345 |
DefineProperties (setter & enumerable=false) | 10,808,961 | 5404486 |
DefineProperties (setter & enumerable=false & configurable=false) | 10,745,003 | 5372522 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:29:03 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Using replace(//g) | 3,327,761 | 1664123 |
Using replaceAll() | 3,173,138 | 1586727 |
Using replaceAll(//g) | 2,954,547 | 1477275 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:30:36 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
{ ...object } | 23,866,701 | 11934262 |
{ ...object, proto: null } | 2,542,283 | 1272917 |
{ ...object, newProp: true } | 20,859,609 | 10429888 |
structuredClone | 296,628 | 148329 |
JSON.parse + JSON.stringify | 296,454 | 148228 |
loop + object.keys starting with {} | 1,625,988 | 813079 |
loop + object.keys starting with { proto: null } | 898,386 | 451373 |
loop + object.keys starting with { randomProp: true } | 655,443 | 327751 |
object.keys + reduce(FN, {}) | 1,706,517 | 853313 |
object.keys + reduce(FN, { proto: null }) | 922,009 | 461012 |
object.keys + reduce(FN, { newProp: true }) | 648,998 | 324507 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:31:32 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Sort using default | 306,352 | 153177 |
Sort using first char | 1,291,047 | 645916 |
Sort using localeCompare | 1,179,265 | 589723 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:33:10 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
{...bigObject} - Total keys: 1000 | 1,699 | 850 |
{...smallObject} - Total keys: 2 | 55,195,465 | 27598245 |
Object.assign({}, bigObject, anotherBigObject) - Total keys: 1000 - creating new object | 1,027 | 514 |
Object.assign(bigObject, anotherBigObject) - mutating bigObject | 6,554 | 3278 |
{ ...bigObject, ...anotherBigObject } | 1,078 | 540 |
Object.assign({}, smallObject, anotherSmallObject) - creating new object | 12,618,800 | 6309516 |
Object.assign(smallObject, anotherSmallObject) - mutating smallObject | 28,351,755 | 14175881 |
{ ...smallObject, ...anotherSmallObject } | 20,053,238 | 10029196 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:34:02 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
streams.Readable reading 1e3 * "some data" | 1,787 | 894 |
streams.web.Readable reading 1e3 * "some data" | 1,705 | 854 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:35:37 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
streams.Writable writing 1e3 * "some data" | 10,394 | 5212 |
streams.web.WritableStream writing 1e3 * "some data" | 1,635 | 818 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:36:31 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Using + sign | 149,497,498 | 74761374 |
Using backtick (`) | 94,071,366 | 47035691 |
Using array.join | 9,962,952 | 4981479 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:37:43 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
(short string) (true) String#endsWith | 128,521,829 | 64338024 |
(short string) (true) String#slice and strict comparison | 50,908,536 | 25457083 |
(long string) (true) String#endsWith | 55,608,429 | 27804220 |
(long string) (true) String#slice and strict comparison | 46,077,236 | 23043525 |
(short string) (false) String#endsWith | 95,740,357 | 47870187 |
(short string) (false) String#slice and strict comparison | 51,102,766 | 25557367 |
(long string) (false) String#endsWith | 86,852,165 | 43426088 |
(long string) (false) String#slice and strict comparison | 45,174,660 | 22593992 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:39:16 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Using includes | 136,251,361 | 68128724 |
Using indexof | 15,442,147 | 7721246 |
Using RegExp.test | 12,800,892 | 6401086 |
Using RegExp.text with cached regex pattern | 13,781,845 | 6890923 |
Using new RegExp.test | 4,575,564 | 2287843 |
Using new RegExp.test with cached regex pattern | 5,379,402 | 2689708 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:40:54 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
(short string) (true) String#startsWith | 127,976,366 | 63988540 |
(short string) (true) String#slice and strict comparison | 58,354,959 | 29177750 |
(long string) (true) String#startsWith | 64,522,356 | 32261201 |
(long string) (true) String#slice and strict comparison | 53,236,320 | 26621299 |
(short string) (false) String#startsWith | 91,437,261 | 45718636 |
(short string) (false) String#slice and strict comparison | 57,466,295 | 28734690 |
(long string) (false) String#startsWith | 87,468,950 | 43745945 |
(long string) (false) String#slice and strict comparison | 52,479,757 | 26239879 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:42:35 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
Using super | 124,641,121 | 62334890 |
Using this | 97,779,425 | 48897456 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:43:22 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0
name | ops/sec | samples |
---|---|---|
new Date().getTime() | 10,230,418 | 5115367 |
Date.now() | 18,655,711 | 9364020 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Fri Oct 11 2024 22:44:38 GMT+0000 (Coordinated Universal Time)
- Node:
v22.9.0