name | ops/sec | samples |
---|---|---|
Directly in the object | 105,354,657 | 52677580 |
Using dot notation | 72,858,303 | 36505473 |
Using define property (writable) | 4,933,376 | 2466690 |
Using define property initialized (writable) | 6,866,553 | 3433432 |
Using define property (getter) | 2,455,899 | 1227986 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 16:45:31 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.004ms |
new Array(length) | 10 | 0.002ms |
array.push | 100 | 0.072ms |
new Array(length) | 100 | 0.006ms |
array.push | 1,000 | 0.028ms |
new Array(length) | 1,000 | 0.013ms |
array.push | 10,000 | 0.263ms |
new Array(length) | 10,000 | 0.136ms |
array.push | 1,000,000 | 28.305ms |
new Array(length) | 1,000,000 | 7.137ms |
array.push | 100,000,000 | 1,851.871ms |
new Array(length) | 100,000,000 | 3,945.689ms |
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.005ms |
new Array(length) | 10 | 0.003ms |
array.push | 100 | 0.016ms |
new Array(length) | 100 | 0.012ms |
array.push | 1,000 | 0.036ms |
new Array(length) | 1,000 | 0.019ms |
array.push | 10,000 | 18.209ms |
new Array(length) | 10,000 | 6.65ms |
array.push | 1,000,000 | 142.99ms |
new Array(length) | 1,000,000 | 7.163ms |
array.push | 100,000,000 | 1,979.962ms |
new Array(length) | 100,000,000 | 4,548.412ms |
name | ops/sec | samples |
---|---|---|
new Array | 332 | 167 |
Array.from | 24 | 13 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 16:59:26 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
new Blob (128) | 4,567 | 2284 |
new Blob (1024) | 625 | 315 |
text (128) | 3,738 | 1871 |
text (1024) | 536 | 275 |
arrayBuffer (128) | 4,329 | 2179 |
arrayBuffer (1024) | 537 | 269 |
slice (0, 64) | 146,774 | 77711 |
slice (0, 512) | 31,704 | 15853 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:05:29 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
[True conditional] Using instanceof only | 455,614 | 228102 |
[True conditional] Using constructor name | 368,301 | 184151 |
[True conditional] Check if property is valid then instanceof | 367,092 | 183550 |
[False conditional] Using instanceof only | 94,613,392 | 47306709 |
[False conditional] Using constructor name | 94,706,984 | 47375194 |
[False conditional] Check if property is valid then instanceof | 96,160,248 | 48097177 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:11:28 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
crypto.createVerify('RSA-SHA256') | 6,641 | 3321 |
crypto.verify('RSA-SHA256') | 6,809 | 3405 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:17:01 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
new Date().toISOString() | 1,405,288 | 702661 |
fromUnixToISOString(new Date()) | 2,152,480 | 1076241 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:22:34 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Intl.DateTimeFormat().format(Date.now()) | 19,164 | 9583 |
Intl.DateTimeFormat().format(new Date()) | 19,139 | 9572 |
Intl.DateTimeFormat(undefined, twoDigitsLocaleOptions).format(Date.now()) | 19,163 | 9582 |
Intl.DateTimeFormat(undefined, twoDigitsLocaleOptions).format(new Date()) | 18,057 | 9210 |
Reusing Intl.DateTimeFormat() | 606,398 | 303387 |
Date.toLocaleDateString() | 1,103,192 | 551736 |
Date.toLocaleDateString(undefined, twoDigitsLocaleOptions) | 23,412 | 11707 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:28:51 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Using String() | 1,034,940 | 517474 |
Using brackets {} | 1,054,166 | 527084 |
Using '' + | 1,053,103 | 526552 |
Using date.toString() | 1,155,629 | 577815 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:34:30 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Using delete property | 4,068,660 | 2034332 |
Using delete property (proto: null) | 16,978,415 | 8489211 |
Using delete property (cached proto: null) | 4,038,433 | 2019409 |
Using undefined assignment | 74,430,591 | 37219608 |
Using undefined assignment (proto: null) | 18,594,854 | 9297912 |
Using undefined property (cached proto: null) | 74,603,525 | 37301767 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:40:20 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Error | 429,662 | 214868 |
NodeError | 347,339 | 173672 |
NodeError Range | 344,859 | 172431 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:46:22 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Function returning null | 1,839,054 | 920006 |
Function returning explicitly undefined | 1,766,366 | 883358 |
Function returning implicitly undefined | 1,897,055 | 948616 |
Function returning string | 1,800,893 | 902021 |
Function returning integer | 1,884,780 | 942391 |
Function returning float | 1,853,762 | 927320 |
Function returning functions | 1,673,022 | 836512 |
Function returning arrow functions | 1,832,722 | 916362 |
Function returning empty object | 1,848,329 | 924171 |
Function returning empty array | 1,838,117 | 921048 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:52:15 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
using Array.includes | 90,754,886 | 45378116 |
using Array.includes (first item) | 82,494,612 | 41249777 |
Using raw comparison | 98,511,723 | 49255868 |
Using raw comparison (first item) | 96,557,480 | 48295199 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:57:40 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Using Object.keys() | 49,310,967 | 24659334 |
Using Object.getOwnPropertyNames() | 42,366,582 | 21183342 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:02:57 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Length = 100 - Array.at | 132,386,004 | 66208172 |
Length = 10_000 - Array.at | 86,770,303 | 43389558 |
Length = 1_000_000 - Array.at | 99,193,056 | 49985508 |
Length = 100 - Array[length - 1] | 98,222,323 | 49111170 |
Length = 10_000 - Array[length - 1] | 97,918,678 | 48959364 |
Length = 1_000_000 - Array[length - 1] | 99,309,669 | 49670135 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:08:48 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Math.floor (small) | 137,155,659 | 68604898 |
~ (small) | 97,172,246 | 48586127 |
Math.floor (long) | 96,935,546 | 48468146 |
~ (long) | 98,290,384 | 49150634 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:14:25 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Object.create(null) | 41,611,272 | 20807019 |
Object.create({}) | 2,107,667 | 1054124 |
Cached Empty.prototype | 112,346,353 | 56177964 |
Empty.prototype | 2,514,749 | 1264364 |
Empty class | 1,558,830 | 779421 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:20:21 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Using optional chain (obj.field?.field2) (Valid) | 148,757,558 | 74378819 |
Using optional chain (obj.field?.field2) (undefined) | 98,110,006 | 49055376 |
Using and operator (obj.field && obj.field.field2) (Valid) | 98,992,645 | 49496324 |
Using and operator (obj.field && obj.field.field2) (undefined) | 98,771,417 | 49385795 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:25:48 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Using parseInt(x, 10) - small number (2 len) | 139,710,708 | 69855369 |
Using parseInt(x, 10) - big number (10 len) | 98,909,300 | 49456287 |
Using + - small number (2 len) | 99,470,325 | 49736067 |
Using + - big number (10 len) | 99,721,670 | 49860842 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:31:32 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Using if to check function existence | 989,293 | 497050 |
Using ? operator to avoid rejection | 1,048,910 | 531828 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:37:17 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Raw usage private field | 143,368,906 | 71684476 |
Raw usage underscore usage | 96,300,313 | 48150167 |
Manipulating private properties using # | 95,570,864 | 47846290 |
Manipulating private properties using underscore(_) | 99,325,166 | 49668956 |
Manipulating private properties using Symbol | 98,661,992 | 49646528 |
Manipulating private properties using PrivateSymbol | 37,130,017 | 18574216 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:43:00 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Adding property after object creation - small object | 8,354,246 | 4177259 |
Adding property in the object creation - small object | 8,278,490 | 4139250 |
Adding property after the function creation - small class | 263,474 | 134632 |
Adding property in the function creation - small class | 251,336 | 126951 |
Adding property after the class creation - small class | 277,262 | 140143 |
Adding property in the class creation - small class | 275,659 | 137836 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:48:39 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Getter (class) | 149,782,416 | 74891562 |
Getter | 49,224,533 | 24612271 |
Method | 100,477,459 | 50238819 |
DefineProperty (getter) | 99,051,657 | 49538847 |
DefineProperty (getter & enumerable=false) | 46,221,888 | 23110973 |
DefineProperty (getter & configurable=false) | 98,435,985 | 49217998 |
DefineProperty (getter & enumerable=false & configurable=false) | 51,897,065 | 25949101 |
DefineProperty (writable) | 98,838,767 | 49419463 |
DefineProperty (writable & enumerable=false) | 97,276,532 | 48638272 |
DefineProperty (writable & enumerable=false & configurable=false) | 96,580,045 | 48290253 |
DefineProperties (getter) | 49,966,247 | 24983128 |
DefineProperties (getter & enumerable=false) | 51,597,698 | 25798853 |
DefineProperties (getter & enumerable=false & configurable=false) | 50,837,472 | 25423800 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:55:18 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Setter (class) | 133,706,878 | 66853462 |
Setter | 11,020,361 | 5510183 |
Method | 83,939,241 | 41971573 |
DefineProperty (setter) | 85,474,393 | 42737287 |
DefineProperty (setter & enumerable=false) | 11,338,321 | 5669164 |
DefineProperty (setter & configurable=false) | 11,412,688 | 5706347 |
DefineProperty (setter & enumerable=false & configurable=false) | 11,163,488 | 5581810 |
DefineProperty (writable) | 93,986,633 | 46993323 |
DefineProperty (writable & enumerable=false) | 95,636,253 | 47818137 |
DefineProperty (writable & enumerable=false & configurable=false) | 94,019,491 | 47009761 |
DefineProperties (setter) | 93,968,148 | 46988064 |
DefineProperties (setter & enumerable=false) | 11,333,264 | 5666815 |
DefineProperties (setter & enumerable=false & configurable=false) | 11,226,923 | 5613538 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:02:02 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Using replace(//g) | 3,386,280 | 1693264 |
Using replaceAll() | 3,316,649 | 1662642 |
Using replaceAll(//g) | 3,081,890 | 1540946 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:07:28 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
{ ...object } | 24,698,204 | 12363889 |
{ ...object, proto: null } | 2,542,973 | 1271686 |
{ ...object, newProp: true } | 21,478,682 | 10739342 |
structuredClone | 312,136 | 156155 |
JSON.parse + JSON.stringify | 309,484 | 154799 |
loop + object.keys starting with {} | 1,674,608 | 837371 |
loop + object.keys starting with { proto: null } | 904,485 | 452243 |
loop + object.keys starting with { randomProp: true } | 676,206 | 338157 |
object.keys + reduce(FN, {}) | 1,733,642 | 866855 |
object.keys + reduce(FN, { proto: null }) | 953,509 | 476755 |
object.keys + reduce(FN, { newProp: true }) | 694,299 | 347210 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:14:08 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Sort using default | 310,400 | 155465 |
Sort using first char | 1,390,555 | 696043 |
Sort using localeCompare | 1,265,789 | 633045 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:19:52 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
{...bigObject} - Total keys: 1000 | 1,846 | 924 |
{...smallObject} - Total keys: 2 | 60,099,156 | 30049597 |
Object.assign({}, bigObject, anotherBigObject) - Total keys: 1000 - creating new object | 1,113 | 557 |
Object.assign(bigObject, anotherBigObject) - mutating bigObject | 6,645 | 3323 |
{ ...bigObject, ...anotherBigObject } | 1,170 | 586 |
Object.assign({}, smallObject, anotherSmallObject) - creating new object | 13,576,607 | 6789163 |
Object.assign(smallObject, anotherSmallObject) - mutating smallObject | 28,381,137 | 14190575 |
{ ...smallObject, ...anotherSmallObject } | 21,478,887 | 10739764 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:25:56 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
streams.Readable reading 1e3 * "some data" | 2,080 | 1049 |
streams.web.Readable reading 1e3 * "some data" | 1,837 | 920 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:31:32 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
streams.Writable writing 1e3 * "some data" | 11,252 | 5627 |
streams.web.WritableStream writing 1e3 * "some data" | 1,717 | 868 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:37:11 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Using + sign | 146,826,651 | 73455018 |
Using backtick (`) | 85,889,756 | 42945317 |
Using array.join | 10,115,028 | 5057516 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:42:52 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
(short string) (true) String#endsWith | 127,013,371 | 63507868 |
(short string) (true) String#slice and strict comparison | 60,501,133 | 30271089 |
(long string) (true) String#endsWith | 63,560,780 | 31781503 |
(long string) (true) String#slice and strict comparison | 54,806,425 | 27404139 |
(short string) (false) String#endsWith | 93,573,670 | 46786860 |
(short string) (false) String#slice and strict comparison | 60,519,280 | 30262717 |
(long string) (false) String#endsWith | 86,030,991 | 43016540 |
(long string) (false) String#slice and strict comparison | 54,686,011 | 27343014 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:48:52 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Using includes | 137,463,093 | 68731564 |
Using indexof | 16,078,526 | 8040203 |
Using RegExp.test | 13,268,565 | 6635279 |
Using RegExp.text with cached regex pattern | 14,521,533 | 7261833 |
Using new RegExp.test | 4,704,632 | 2352429 |
Using new RegExp.test with cached regex pattern | 5,507,605 | 2753804 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:54:55 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
(short string) (true) String#startsWith | 126,589,063 | 63294539 |
(short string) (true) String#slice and strict comparison | 60,375,624 | 30245825 |
(long string) (true) String#startsWith | 63,280,920 | 31640598 |
(long string) (true) String#slice and strict comparison | 54,283,379 | 27141697 |
(short string) (false) String#startsWith | 93,748,836 | 46876729 |
(short string) (false) String#slice and strict comparison | 60,445,194 | 30222605 |
(long string) (false) String#startsWith | 87,917,047 | 43980194 |
(long string) (false) String#slice and strict comparison | 54,281,871 | 27140942 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 20:01:06 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
Using super | 125,079,745 | 62545767 |
Using this | 96,500,329 | 48393262 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 20:10:11 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0
name | ops/sec | samples |
---|---|---|
new Date().getTime() | 9,836,232 | 4918390 |
Date.now() | 19,263,162 | 9632930 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 20:15:43 GMT+0000 (Coordinated Universal Time)
- Node:
v22.11.0