name | ops/sec | samples |
---|---|---|
Directly in the object | 101,201,863 | 50609978 |
Using dot notation | 70,660,815 | 35334950 |
Using define property (writable) | 4,206,612 | 2103308 |
Using define property initialized (writable) | 5,963,283 | 2981843 |
Using define property (getter) | 2,245,392 | 1122727 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 16:44:44 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.004ms |
new Array(length) | 10 | 0.002ms |
array.push | 100 | 0.02ms |
new Array(length) | 100 | 0.013ms |
array.push | 1,000 | 0.028ms |
new Array(length) | 1,000 | 0.014ms |
array.push | 10,000 | 0.249ms |
new Array(length) | 10,000 | 0.142ms |
array.push | 1,000,000 | 24.293ms |
new Array(length) | 1,000,000 | 14.371ms |
array.push | 100,000,000 | 1,760.975ms |
new Array(length) | 100,000,000 | 4,468.255ms |
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.004ms |
new Array(length) | 10 | 0.003ms |
array.push | 100 | 0.015ms |
new Array(length) | 100 | 0.012ms |
array.push | 1,000 | 0.039ms |
new Array(length) | 1,000 | 0.02ms |
array.push | 10,000 | 0.323ms |
new Array(length) | 10,000 | 0.219ms |
array.push | 1,000,000 | 19.999ms |
new Array(length) | 1,000,000 | 7.432ms |
array.push | 100,000,000 | 1,938.284ms |
new Array(length) | 100,000,000 | 4,447.11ms |
name | ops/sec | samples |
---|---|---|
new Array | 264 | 133 |
Array.from | 23 | 12 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 16:58:46 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
new Blob (128) | 4,635 | 2318 |
new Blob (1024) | 607 | 304 |
text (128) | 4,895 | 2448 |
text (1024) | 614 | 308 |
arrayBuffer (128) | 4,877 | 2442 |
arrayBuffer (1024) | 620 | 312 |
slice (0, 64) | 161,535 | 80927 |
slice (0, 512) | 31,776 | 15889 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:04:40 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
[True conditional] Using instanceof only | 426,866 | 213467 |
[True conditional] Using constructor name | 351,140 | 175571 |
[True conditional] Check if property is valid then instanceof | 343,706 | 172190 |
[False conditional] Using instanceof only | 93,583,673 | 46791846 |
[False conditional] Using constructor name | 95,525,588 | 47766146 |
[False conditional] Check if property is valid then instanceof | 95,824,032 | 47921762 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:10:46 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
crypto.createVerify('RSA-SHA256') | 6,795 | 3398 |
crypto.verify('RSA-SHA256') | 6,891 | 3447 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:16:18 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
new Date().toISOString() | 1,510,585 | 755302 |
fromUnixToISOString(new Date()) | 2,097,247 | 1048784 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:21:55 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Intl.DateTimeFormat().format(Date.now()) | 19,059 | 9530 |
Intl.DateTimeFormat().format(new Date()) | 18,949 | 9475 |
Intl.DateTimeFormat(undefined, twoDigitsLocaleOptions).format(Date.now()) | 19,109 | 9555 |
Intl.DateTimeFormat(undefined, twoDigitsLocaleOptions).format(new Date()) | 18,572 | 9314 |
Reusing Intl.DateTimeFormat() | 393,558 | 205605 |
Date.toLocaleDateString() | 718,524 | 359427 |
Date.toLocaleDateString(undefined, twoDigitsLocaleOptions) | 23,424 | 11713 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:28:26 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Using String() | 911,226 | 455614 |
Using brackets {} | 910,457 | 455233 |
Using '' + | 1,090,541 | 545271 |
Using date.toString() | 1,165,321 | 582970 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:33:47 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Using delete property | 3,946,863 | 1973434 |
Using delete property (proto: null) | 16,215,056 | 8124300 |
Using delete property (cached proto: null) | 3,873,358 | 1936681 |
Using undefined assignment | 77,742,529 | 39235537 |
Using undefined assignment (proto: null) | 18,277,869 | 9140756 |
Using undefined property (cached proto: null) | 78,314,465 | 39163054 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:39:37 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Error | 392,217 | 196140 |
NodeError | 331,055 | 165528 |
NodeError Range | 326,164 | 163091 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:45:01 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Function returning null | 1,953,803 | 977016 |
Function returning explicitly undefined | 1,844,722 | 922483 |
Function returning implicitly undefined | 1,927,092 | 964112 |
Function returning string | 1,888,703 | 944352 |
Function returning integer | 1,954,012 | 977102 |
Function returning float | 1,944,657 | 972567 |
Function returning functions | 1,869,613 | 934807 |
Function returning arrow functions | 1,919,298 | 959650 |
Function returning empty object | 1,855,366 | 927685 |
Function returning empty array | 1,941,881 | 970941 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:50:43 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
using Array.includes | 89,798,914 | 44900677 |
using Array.includes (first item) | 79,858,458 | 39929236 |
Using raw comparison | 94,669,378 | 47335183 |
Using raw comparison (first item) | 92,835,632 | 46417821 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:57:19 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Using Object.keys() | 52,284,779 | 26142458 |
Using Object.getOwnPropertyNames() | 42,781,095 | 21390549 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:02:17 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Length = 100 - Array.at | 135,595,432 | 67800103 |
Length = 10_000 - Array.at | 95,556,900 | 47778483 |
Length = 1_000_000 - Array.at | 96,835,809 | 48423677 |
Length = 100 - Array[length - 1] | 94,659,272 | 47334478 |
Length = 10_000 - Array[length - 1] | 97,264,221 | 48791441 |
Length = 1_000_000 - Array[length - 1] | 96,898,484 | 48456396 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:07:39 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Math.floor (small) | 129,517,485 | 64758769 |
~ (small) | 89,417,247 | 44708628 |
Math.floor (long) | 88,125,691 | 44062850 |
~ (long) | 90,874,320 | 45437164 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:13:44 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Object.create(null) | 45,921,144 | 22960573 |
Object.create({}) | 2,057,137 | 1042896 |
Cached Empty.prototype | 115,699,846 | 57850337 |
Empty.prototype | 2,204,891 | 1102470 |
Empty class | 1,377,975 | 688995 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:19:17 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Using optional chain (obj.field?.field2) (Valid) | 144,790,472 | 72395257 |
Using optional chain (obj.field?.field2) (undefined) | 98,635,833 | 49351409 |
Using and operator (obj.field && obj.field.field2) (Valid) | 102,522,932 | 51262001 |
Using and operator (obj.field && obj.field.field2) (undefined) | 101,554,652 | 51219617 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:25:07 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Using parseInt(x, 10) - small number (2 len) | 141,987,453 | 71020690 |
Using parseInt(x, 10) - big number (10 len) | 102,335,399 | 51167811 |
Using + - small number (2 len) | 101,350,815 | 50815311 |
Using + - big number (10 len) | 101,833,022 | 50916512 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:30:31 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Using if to check function existence | 1,037,863 | 521543 |
Using ? operator to avoid rejection | 1,177,121 | 588585 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:36:18 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Raw usage private field | 136,647,711 | 68364745 |
Raw usage underscore usage | 95,030,765 | 47515950 |
Manipulating private properties using # | 95,581,216 | 49018486 |
Manipulating private properties using underscore(_) | 96,857,458 | 48428736 |
Manipulating private properties using Symbol | 99,057,946 | 49536653 |
Manipulating private properties using PrivateSymbol | 34,268,963 | 17134876 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:42:38 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Adding property after object creation - small object | 7,605,274 | 3802844 |
Adding property in the object creation - small object | 7,352,817 | 3676816 |
Adding property after the function creation - small class | 237,578 | 119201 |
Adding property in the function creation - small class | 250,902 | 126024 |
Adding property after the class creation - small class | 242,140 | 121072 |
Adding property in the class creation - small class | 241,428 | 121382 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:47:57 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Getter (class) | 138,793,632 | 69397766 |
Getter | 50,204,090 | 25150313 |
Method | 99,207,808 | 49618166 |
DefineProperty (getter) | 97,187,230 | 48593617 |
DefineProperty (getter & enumerable=false) | 48,228,113 | 24150754 |
DefineProperty (getter & configurable=false) | 95,758,104 | 47879060 |
DefineProperty (getter & enumerable=false & configurable=false) | 51,165,081 | 25582552 |
DefineProperty (writable) | 97,656,848 | 48830966 |
DefineProperty (writable & enumerable=false) | 97,624,563 | 48817541 |
DefineProperty (writable & enumerable=false & configurable=false) | 97,850,971 | 48927524 |
DefineProperties (getter) | 51,520,069 | 25760048 |
DefineProperties (getter & enumerable=false) | 51,149,559 | 25576158 |
DefineProperties (getter & enumerable=false & configurable=false) | 50,563,156 | 25281736 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:54:02 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Setter (class) | 142,313,880 | 71156982 |
Setter | 11,325,090 | 5662550 |
Method | 93,340,326 | 46684329 |
DefineProperty (setter) | 99,974,733 | 49987448 |
DefineProperty (setter & enumerable=false) | 11,696,351 | 5851173 |
DefineProperty (setter & configurable=false) | 11,509,578 | 5754793 |
DefineProperty (setter & enumerable=false & configurable=false) | 11,711,929 | 5855967 |
DefineProperty (writable) | 98,981,158 | 49495219 |
DefineProperty (writable & enumerable=false) | 99,368,868 | 49700904 |
DefineProperty (writable & enumerable=false & configurable=false) | 99,417,864 | 49714778 |
DefineProperties (setter) | 96,410,659 | 48210427 |
DefineProperties (setter & enumerable=false) | 11,352,534 | 5676278 |
DefineProperties (setter & enumerable=false & configurable=false) | 11,416,136 | 5708128 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:01:11 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Using replace(//g) | 3,403,134 | 1701568 |
Using replaceAll() | 3,114,553 | 1557873 |
Using replaceAll(//g) | 3,168,608 | 1584305 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:06:47 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
{ ...object } | 24,714,609 | 12357630 |
{ ...object, proto: null } | 2,566,008 | 1283005 |
{ ...object, newProp: true } | 21,237,459 | 10619982 |
structuredClone | 294,611 | 147321 |
JSON.parse + JSON.stringify | 273,863 | 136932 |
loop + object.keys starting with {} | 1,584,145 | 792258 |
loop + object.keys starting with { proto: null } | 842,892 | 421447 |
loop + object.keys starting with { randomProp: true } | 649,831 | 324933 |
object.keys + reduce(FN, {}) | 1,653,605 | 826948 |
object.keys + reduce(FN, { proto: null }) | 870,600 | 435364 |
object.keys + reduce(FN, { newProp: true }) | 665,892 | 332989 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:12:54 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Sort using default | 307,245 | 153654 |
Sort using first char | 1,368,288 | 684892 |
Sort using localeCompare | 1,279,376 | 639854 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:19:31 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
{...bigObject} - Total keys: 1000 | 1,870 | 938 |
{...smallObject} - Total keys: 2 | 59,146,405 | 29596653 |
Object.assign({}, bigObject, anotherBigObject) - Total keys: 1000 - creating new object | 1,095 | 548 |
Object.assign(bigObject, anotherBigObject) - mutating bigObject | 6,533 | 3267 |
{ ...bigObject, ...anotherBigObject } | 1,167 | 584 |
Object.assign({}, smallObject, anotherSmallObject) - creating new object | 12,678,430 | 6341033 |
Object.assign(smallObject, anotherSmallObject) - mutating smallObject | 29,165,903 | 14583249 |
{ ...smallObject, ...anotherSmallObject } | 20,792,578 | 10396306 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:25:07 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
streams.Readable reading 1e3 * "some data" | 2,167 | 1100 |
streams.web.Readable reading 1e3 * "some data" | 1,811 | 906 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:30:49 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
streams.Writable writing 1e3 * "some data" | 6,528 | 3265 |
streams.web.WritableStream writing 1e3 * "some data" | 1,841 | 932 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:36:29 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Using + sign | 136,701,211 | 68350609 |
Using backtick (`) | 98,384,466 | 49232334 |
Using array.join | 10,366,621 | 5183312 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:42:11 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
(short string) (true) String#endsWith | 111,693,599 | 56088955 |
(short string) (true) String#slice and strict comparison | 59,265,544 | 29637282 |
(long string) (true) String#endsWith | 62,732,661 | 31366352 |
(long string) (true) String#slice and strict comparison | 53,692,569 | 26846294 |
(short string) (false) String#endsWith | 96,674,201 | 48351590 |
(short string) (false) String#slice and strict comparison | 59,439,353 | 29719678 |
(long string) (false) String#endsWith | 89,338,837 | 44673021 |
(long string) (false) String#slice and strict comparison | 53,599,009 | 26799550 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:48:05 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Using includes | 134,737,796 | 67368915 |
Using indexof | 15,736,670 | 7868337 |
Using RegExp.test | 13,326,873 | 6663492 |
Using RegExp.text with cached regex pattern | 14,237,984 | 7119037 |
Using new RegExp.test | 4,592,313 | 2296158 |
Using new RegExp.test with cached regex pattern | 5,194,839 | 2597628 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:54:12 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
(short string) (true) String#startsWith | 106,238,828 | 53181782 |
(short string) (true) String#slice and strict comparison | 59,554,357 | 29785901 |
(long string) (true) String#startsWith | 64,145,400 | 32073264 |
(long string) (true) String#slice and strict comparison | 53,724,477 | 26887018 |
(short string) (false) String#startsWith | 99,102,557 | 49552007 |
(short string) (false) String#slice and strict comparison | 59,809,998 | 29905149 |
(long string) (false) String#startsWith | 82,695,957 | 41352782 |
(long string) (false) String#slice and strict comparison | 53,790,207 | 26895110 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:59:57 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
Using super | 121,250,684 | 60625897 |
Using this | 90,374,201 | 45187267 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 20:09:30 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3
name | ops/sec | samples |
---|---|---|
new Date().getTime() | 11,672,894 | 5836835 |
Date.now() | 19,354,623 | 9677314 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 20:15:21 GMT+0000 (Coordinated Universal Time)
- Node:
v21.7.3