name | ops/sec | samples |
---|---|---|
Directly in the object | 103,670,460 | 51842768 |
Using dot notation | 74,170,400 | 37111111 |
Using define property (writable) | 4,185,897 | 2093102 |
Using define property initialized (writable) | 5,836,156 | 2918273 |
Using define property (getter) | 2,215,100 | 1107559 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 16:44:00 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.017ms |
new Array(length) | 10 | 0.002ms |
array.push | 100 | 0.086ms |
new Array(length) | 100 | 0.011ms |
array.push | 1,000 | 0.048ms |
new Array(length) | 1,000 | 0.015ms |
array.push | 10,000 | 0.259ms |
new Array(length) | 10,000 | 0.136ms |
array.push | 1,000,000 | 22.399ms |
new Array(length) | 1,000,000 | 15.657ms |
array.push | 100,000,000 | 1,774.154ms |
new Array(length) | 100,000,000 | 4,426.278ms |
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.007ms |
new Array(length) | 10 | 0.003ms |
array.push | 100 | 0.018ms |
new Array(length) | 100 | 0.012ms |
array.push | 1,000 | 0.039ms |
new Array(length) | 1,000 | 0.02ms |
array.push | 10,000 | 0.344ms |
new Array(length) | 10,000 | 0.227ms |
array.push | 1,000,000 | 22.413ms |
new Array(length) | 1,000,000 | 7.795ms |
array.push | 100,000,000 | 1,940.322ms |
new Array(length) | 100,000,000 | 4,420.924ms |
name | ops/sec | samples |
---|---|---|
new Array | 263 | 132 |
Array.from | 23 | 12 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 16:58:03 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
new Blob (128) | 4,756 | 2379 |
new Blob (1024) | 614 | 308 |
text (128) | 4,841 | 2426 |
text (1024) | 592 | 297 |
arrayBuffer (128) | 4,879 | 2440 |
arrayBuffer (1024) | 606 | 304 |
slice (0, 64) | 156,997 | 94538 |
slice (0, 512) | 33,703 | 16852 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:03:54 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
[True conditional] Using instanceof only | 414,495 | 207248 |
[True conditional] Using constructor name | 335,907 | 168027 |
[True conditional] Check if property is valid then instanceof | 332,352 | 166352 |
[False conditional] Using instanceof only | 98,267,465 | 49139881 |
[False conditional] Using constructor name | 96,745,829 | 48372923 |
[False conditional] Check if property is valid then instanceof | 96,547,738 | 48274589 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:10:03 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
crypto.createVerify('RSA-SHA256') | 6,229 | 3115 |
crypto.verify('RSA-SHA256') | 6,471 | 3236 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:15:38 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
new Date().toISOString() | 1,502,132 | 751272 |
fromUnixToISOString(new Date()) | 2,134,896 | 1067559 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:21:15 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Intl.DateTimeFormat().format(Date.now()) | 19,090 | 9546 |
Intl.DateTimeFormat().format(new Date()) | 19,098 | 9550 |
Intl.DateTimeFormat(undefined, twoDigitsLocaleOptions).format(Date.now()) | 18,590 | 9297 |
Intl.DateTimeFormat(undefined, twoDigitsLocaleOptions).format(new Date()) | 18,655 | 9328 |
Reusing Intl.DateTimeFormat() | 452,681 | 287525 |
Date.toLocaleDateString() | 724,525 | 362466 |
Date.toLocaleDateString(undefined, twoDigitsLocaleOptions) | 23,222 | 11612 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:27:20 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Using String() | 1,084,539 | 542307 |
Using brackets {} | 1,038,013 | 519007 |
Using '' + | 1,034,085 | 517043 |
Using date.toString() | 1,166,181 | 583151 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:33:07 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Using delete property | 3,903,647 | 1951930 |
Using delete property (proto: null) | 16,592,144 | 8296075 |
Using delete property (cached proto: null) | 3,890,492 | 1945546 |
Using undefined assignment | 77,381,207 | 38690610 |
Using undefined assignment (proto: null) | 18,450,766 | 9226130 |
Using undefined property (cached proto: null) | 75,787,892 | 37898378 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:38:54 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Error | 390,719 | 195386 |
NodeError | 322,704 | 161357 |
NodeError Range | 320,555 | 160278 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:44:21 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Function returning null | 1,924,883 | 962964 |
Function returning explicitly undefined | 1,953,036 | 977695 |
Function returning implicitly undefined | 1,972,461 | 987334 |
Function returning string | 1,949,491 | 974823 |
Function returning integer | 2,008,822 | 1004412 |
Function returning float | 1,977,707 | 988854 |
Function returning functions | 1,909,920 | 954961 |
Function returning arrow functions | 2,000,805 | 1000446 |
Function returning empty object | 1,965,833 | 982917 |
Function returning empty array | 1,976,924 | 988529 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:50:19 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
using Array.includes | 84,470,380 | 42236465 |
using Array.includes (first item) | 75,994,202 | 38052157 |
Using raw comparison | 101,627,581 | 50813797 |
Using raw comparison (first item) | 99,905,404 | 50023164 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:56:18 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Using Object.keys() | 49,988,434 | 25004396 |
Using Object.getOwnPropertyNames() | 40,611,235 | 20329331 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:01:38 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Length = 100 - Array.at | 131,797,738 | 65975464 |
Length = 10_000 - Array.at | 83,240,010 | 41644276 |
Length = 1_000_000 - Array.at | 96,760,883 | 48380452 |
Length = 100 - Array[length - 1] | 91,095,922 | 45548399 |
Length = 10_000 - Array[length - 1] | 86,583,634 | 43291825 |
Length = 1_000_000 - Array[length - 1] | 97,859,278 | 48929661 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:07:18 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Math.floor (small) | 139,584,953 | 69800791 |
~ (small) | 93,191,462 | 46596005 |
Math.floor (long) | 94,132,130 | 47066072 |
~ (long) | 93,807,310 | 46903662 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:12:57 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Object.create(null) | 40,873,418 | 20484049 |
Object.create({}) | 1,982,277 | 991140 |
Cached Empty.prototype | 79,580,401 | 39872234 |
Empty.prototype | 2,235,615 | 1119316 |
Empty class | 1,397,210 | 704432 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:18:46 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Using optional chain (obj.field?.field2) (Valid) | 145,795,415 | 73046212 |
Using optional chain (obj.field?.field2) (undefined) | 97,364,319 | 48748319 |
Using and operator (obj.field && obj.field.field2) (Valid) | 102,770,258 | 51385133 |
Using and operator (obj.field && obj.field.field2) (undefined) | 102,045,992 | 51023076 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:24:22 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Using parseInt(x, 10) - small number (2 len) | 141,005,001 | 70784213 |
Using parseInt(x, 10) - big number (10 len) | 97,356,466 | 48692810 |
Using + - small number (2 len) | 103,400,299 | 51701531 |
Using + - big number (10 len) | 101,799,486 | 50911695 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:30:10 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Using if to check function existence | 1,138,402 | 571533 |
Using ? operator to avoid rejection | 1,194,650 | 597776 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:35:58 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Raw usage private field | 132,946,525 | 66473283 |
Raw usage underscore usage | 97,029,318 | 48659710 |
Manipulating private properties using # | 92,648,528 | 46324464 |
Manipulating private properties using underscore(_) | 98,494,514 | 49254932 |
Manipulating private properties using Symbol | 98,826,255 | 49413136 |
Manipulating private properties using PrivateSymbol | 37,109,970 | 18555649 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:41:34 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Adding property after object creation - small object | 7,777,846 | 3893230 |
Adding property in the object creation - small object | 7,356,522 | 3678263 |
Adding property after the function creation - small class | 230,304 | 115154 |
Adding property in the function creation - small class | 245,889 | 123669 |
Adding property after the class creation - small class | 242,719 | 121856 |
Adding property in the class creation - small class | 238,981 | 119491 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:47:14 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Getter (class) | 139,357,176 | 69748575 |
Getter | 52,866,461 | 26433238 |
Method | 100,831,913 | 50415966 |
DefineProperty (getter) | 86,262,667 | 43168255 |
DefineProperty (getter & enumerable=false) | 53,435,342 | 26719023 |
DefineProperty (getter & configurable=false) | 101,452,757 | 50726385 |
DefineProperty (getter & enumerable=false & configurable=false) | 52,912,250 | 26456141 |
DefineProperty (writable) | 102,048,020 | 51024843 |
DefineProperty (writable & enumerable=false) | 101,573,435 | 50786727 |
DefineProperty (writable & enumerable=false & configurable=false) | 101,361,895 | 50681007 |
DefineProperties (getter) | 50,929,186 | 25464597 |
DefineProperties (getter & enumerable=false) | 53,558,349 | 26780450 |
DefineProperties (getter & enumerable=false & configurable=false) | 53,500,802 | 26750774 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:53:37 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Setter (class) | 145,502,949 | 72752119 |
Setter | 11,149,804 | 5574915 |
Method | 97,887,721 | 48956032 |
DefineProperty (setter) | 100,320,695 | 50162625 |
DefineProperty (setter & enumerable=false) | 11,810,902 | 5905454 |
DefineProperty (setter & configurable=false) | 11,605,233 | 5802620 |
DefineProperty (setter & enumerable=false & configurable=false) | 11,817,948 | 5912493 |
DefineProperty (writable) | 99,547,653 | 49776010 |
DefineProperty (writable & enumerable=false) | 100,549,746 | 50495126 |
DefineProperty (writable & enumerable=false & configurable=false) | 100,198,246 | 50099130 |
DefineProperties (setter) | 99,038,687 | 49519377 |
DefineProperties (setter & enumerable=false) | 10,940,252 | 5470129 |
DefineProperties (setter & enumerable=false & configurable=false) | 11,235,148 | 5617577 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:00:20 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Using replace(//g) | 3,406,272 | 1703138 |
Using replaceAll() | 3,103,340 | 1553501 |
Using replaceAll(//g) | 3,082,683 | 1541343 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:06:27 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
{ ...object } | 24,314,355 | 12159045 |
{ ...object, proto: null } | 2,568,263 | 1284200 |
{ ...object, newProp: true } | 20,545,083 | 10273322 |
structuredClone | 272,109 | 136055 |
JSON.parse + JSON.stringify | 273,144 | 136573 |
loop + object.keys starting with {} | 1,581,570 | 790827 |
loop + object.keys starting with { proto: null } | 870,741 | 435727 |
loop + object.keys starting with { randomProp: true } | 635,933 | 317967 |
object.keys + reduce(FN, {}) | 1,624,367 | 812184 |
object.keys + reduce(FN, { proto: null }) | 889,153 | 444720 |
object.keys + reduce(FN, { newProp: true }) | 664,229 | 332115 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:12:31 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Sort using default | 309,129 | 154663 |
Sort using first char | 1,390,385 | 696972 |
Sort using localeCompare | 1,278,265 | 639263 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:18:29 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
{...bigObject} - Total keys: 1000 | 1,918 | 960 |
{...smallObject} - Total keys: 2 | 57,097,545 | 28549182 |
Object.assign({}, bigObject, anotherBigObject) - Total keys: 1000 - creating new object | 1,118 | 560 |
Object.assign(bigObject, anotherBigObject) - mutating bigObject | 6,774 | 3388 |
{ ...bigObject, ...anotherBigObject } | 1,192 | 597 |
Object.assign({}, smallObject, anotherSmallObject) - creating new object | 12,877,333 | 6438694 |
Object.assign(smallObject, anotherSmallObject) - mutating smallObject | 28,346,483 | 14175030 |
{ ...smallObject, ...anotherSmallObject } | 21,081,508 | 10540774 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:24:20 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
streams.Readable reading 1e3 * "some data" | 2,311 | 1157 |
streams.web.Readable reading 1e3 * "some data" | 2,259 | 1131 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:30:08 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
streams.Writable writing 1e3 * "some data" | 6,370 | 3187 |
streams.web.WritableStream writing 1e3 * "some data" | 2,137 | 1069 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:35:03 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Using + sign | 149,913,213 | 74956718 |
Using backtick (`) | 100,415,056 | 50686076 |
Using array.join | 9,837,415 | 4918717 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:41:26 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
(short string) (true) String#endsWith | 111,654,553 | 55827290 |
(short string) (true) String#slice and strict comparison | 58,275,924 | 29143965 |
(long string) (true) String#endsWith | 60,748,114 | 30380046 |
(long string) (true) String#slice and strict comparison | 52,720,372 | 26361140 |
(short string) (false) String#endsWith | 89,525,608 | 44763533 |
(short string) (false) String#slice and strict comparison | 58,124,587 | 29062328 |
(long string) (false) String#endsWith | 84,188,712 | 42094389 |
(long string) (false) String#slice and strict comparison | 52,466,898 | 26233457 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:46:53 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Using includes | 135,563,051 | 67782765 |
Using indexof | 15,884,570 | 7942526 |
Using RegExp.test | 13,231,719 | 6616686 |
Using RegExp.text with cached regex pattern | 14,451,034 | 7225525 |
Using new RegExp.test | 4,559,621 | 2280019 |
Using new RegExp.test with cached regex pattern | 5,285,915 | 2644464 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:53:30 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
(short string) (true) String#startsWith | 112,031,811 | 56015965 |
(short string) (true) String#slice and strict comparison | 59,179,482 | 29611859 |
(long string) (true) String#startsWith | 63,082,978 | 31541494 |
(long string) (true) String#slice and strict comparison | 52,280,956 | 26141696 |
(short string) (false) String#startsWith | 97,999,772 | 49058391 |
(short string) (false) String#slice and strict comparison | 58,819,553 | 29420785 |
(long string) (false) String#startsWith | 85,372,033 | 42951892 |
(long string) (false) String#slice and strict comparison | 52,955,689 | 26480751 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:59:34 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
Using super | 127,533,917 | 63766978 |
Using this | 97,485,340 | 48761304 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 20:08:50 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0
name | ops/sec | samples |
---|---|---|
new Date().getTime() | 11,497,657 | 5749183 |
Date.now() | 20,082,158 | 10051704 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 20:14:21 GMT+0000 (Coordinated Universal Time)
- Node:
v21.0.0