name | ops/sec | samples |
---|---|---|
Directly in the object | 108,188,193 | 54100299 |
Using dot notation | 66,411,065 | 33217082 |
Using define property (writable) | 4,255,099 | 2127550 |
Using define property initialized (writable) | 5,674,180 | 2837633 |
Using define property (getter) | 2,128,752 | 1067070 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 16:43:39 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.004ms |
new Array(length) | 10 | 0.002ms |
array.push | 100 | 0.084ms |
new Array(length) | 100 | 0.007ms |
array.push | 1,000 | 0.031ms |
new Array(length) | 1,000 | 0.016ms |
array.push | 10,000 | 0.285ms |
new Array(length) | 10,000 | 0.317ms |
array.push | 1,000,000 | 32.133ms |
new Array(length) | 1,000,000 | 7.056ms |
array.push | 100,000,000 | 1,768.426ms |
new Array(length) | 100,000,000 | 4,427.88ms |
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.004ms |
new Array(length) | 10 | 0.003ms |
array.push | 100 | 0.013ms |
new Array(length) | 100 | 0.011ms |
array.push | 1,000 | 0.038ms |
new Array(length) | 1,000 | 0.022ms |
array.push | 10,000 | 0.248ms |
new Array(length) | 10,000 | 0.2ms |
array.push | 1,000,000 | 25.401ms |
new Array(length) | 1,000,000 | 4.618ms |
array.push | 100,000,000 | 2,475.612ms |
new Array(length) | 100,000,000 | 4,115.02ms |
name | ops/sec | samples |
---|---|---|
new Array | 258 | 130 |
Array.from | 22 | 12 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 16:57:42 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
new Blob (128) | 4,413 | 2207 |
new Blob (1024) | 576 | 289 |
text (128) | 4,489 | 2245 |
text (1024) | 564 | 284 |
arrayBuffer (128) | 4,541 | 2275 |
arrayBuffer (1024) | 567 | 284 |
slice (0, 64) | 63,916 | 36623 |
slice (0, 512) | 24,690 | 12346 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:03:28 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
[True conditional] Using instanceof only | 390,674 | 195503 |
[True conditional] Using constructor name | 317,239 | 158620 |
[True conditional] Check if property is valid then instanceof | 316,449 | 158225 |
[False conditional] Using instanceof only | 97,094,140 | 48547929 |
[False conditional] Using constructor name | 97,085,882 | 48542946 |
[False conditional] Check if property is valid then instanceof | 97,105,488 | 48552806 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:09:42 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
crypto.createVerify('RSA-SHA256') | 6,643 | 3322 |
crypto.verify('RSA-SHA256') | 6,710 | 3356 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:15:18 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
new Date().toISOString() | 1,396,202 | 698353 |
fromUnixToISOString(new Date()) | 2,099,075 | 1049858 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:20:55 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Intl.DateTimeFormat().format(Date.now()) | 17,736 | 8869 |
Intl.DateTimeFormat().format(new Date()) | 17,362 | 8697 |
Intl.DateTimeFormat(undefined, twoDigitsLocaleOptions).format(Date.now()) | 18,192 | 9097 |
Intl.DateTimeFormat(undefined, twoDigitsLocaleOptions).format(new Date()) | 17,880 | 8941 |
Reusing Intl.DateTimeFormat() | 545,233 | 315115 |
Date.toLocaleDateString() | 912,065 | 456033 |
Date.toLocaleDateString(undefined, twoDigitsLocaleOptions) | 21,203 | 10602 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:26:36 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Using String() | 1,023,260 | 511669 |
Using brackets {} | 1,039,678 | 519840 |
Using '' + | 1,041,182 | 520856 |
Using date.toString() | 1,156,117 | 578089 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:32:47 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Using delete property | 3,655,915 | 1828162 |
Using delete property (proto: null) | 16,003,078 | 8001549 |
Using delete property (cached proto: null) | 3,620,518 | 1810459 |
Using undefined assignment | 73,322,871 | 36665539 |
Using undefined assignment (proto: null) | 16,971,252 | 8486424 |
Using undefined property (cached proto: null) | 73,312,508 | 36656261 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:38:11 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Error | 367,731 | 183991 |
NodeError | 315,507 | 157754 |
NodeError Range | 308,188 | 154105 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:44:02 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Function returning null | 1,672,523 | 836263 |
Function returning explicitly undefined | 1,576,618 | 788805 |
Function returning implicitly undefined | 1,612,441 | 806293 |
Function returning string | 1,596,578 | 798330 |
Function returning integer | 1,623,309 | 811655 |
Function returning float | 1,609,957 | 805021 |
Function returning functions | 1,556,193 | 778150 |
Function returning arrow functions | 1,563,626 | 781895 |
Function returning empty object | 1,618,813 | 809407 |
Function returning empty array | 1,625,682 | 812842 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:49:56 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
using Array.includes | 77,350,595 | 38748307 |
using Array.includes (first item) | 73,508,985 | 36786647 |
Using raw comparison | 97,666,529 | 48864719 |
Using raw comparison (first item) | 98,183,655 | 49092563 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 17:55:38 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Using Object.keys() | 49,578,540 | 24791235 |
Using Object.getOwnPropertyNames() | 42,417,080 | 21211765 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:01:19 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Length = 100 - Array.at | 131,854,685 | 65927390 |
Length = 10_000 - Array.at | 91,730,058 | 45865955 |
Length = 1_000_000 - Array.at | 97,514,925 | 48757472 |
Length = 100 - Array[length - 1] | 95,092,439 | 47546442 |
Length = 10_000 - Array[length - 1] | 95,418,296 | 47714963 |
Length = 1_000_000 - Array[length - 1] | 95,371,580 | 47693982 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:06:56 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Math.floor (small) | 140,595,610 | 70297844 |
~ (small) | 97,605,146 | 48802584 |
Math.floor (long) | 99,300,443 | 49665174 |
~ (long) | 99,576,514 | 49806921 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:12:37 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Object.create(null) | 44,299,270 | 22210241 |
Object.create({}) | 1,910,672 | 955337 |
Cached Empty.prototype | 82,621,637 | 41310864 |
Empty.prototype | 2,197,915 | 1102864 |
Empty class | 1,366,466 | 683234 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:18:24 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Using optional chain (obj.field?.field2) (Valid) | 119,513,569 | 59768289 |
Using optional chain (obj.field?.field2) (undefined) | 96,443,879 | 48221952 |
Using and operator (obj.field && obj.field.field2) (Valid) | 97,884,533 | 48942559 |
Using and operator (obj.field && obj.field.field2) (undefined) | 97,696,965 | 48848876 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:24:02 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Using parseInt(x, 10) - small number (2 len) | 142,155,753 | 71077900 |
Using parseInt(x, 10) - big number (10 len) | 89,211,357 | 44666124 |
Using + - small number (2 len) | 99,812,366 | 49939813 |
Using + - big number (10 len) | 98,944,329 | 49488636 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:29:49 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Using if to check function existence | 896,336 | 449372 |
Using ? operator to avoid rejection | 983,602 | 493444 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:35:18 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Raw usage private field | 130,292,510 | 65146272 |
Raw usage underscore usage | 97,973,350 | 48986684 |
Manipulating private properties using # | 98,753,864 | 49430946 |
Manipulating private properties using underscore(_) | 98,015,379 | 49047991 |
Manipulating private properties using Symbol | 97,744,238 | 48872130 |
Manipulating private properties using PrivateSymbol | 35,776,522 | 17893614 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:40:52 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Adding property after object creation - small object | 7,772,339 | 3886177 |
Adding property in the object creation - small object | 7,124,070 | 3562100 |
Adding property after the function creation - small class | 222,099 | 111921 |
Adding property in the function creation - small class | 241,599 | 121572 |
Adding property after the class creation - small class | 239,210 | 119824 |
Adding property in the class creation - small class | 235,354 | 117685 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:46:52 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Getter (class) | 148,265,593 | 74132864 |
Getter | 51,646,375 | 25823192 |
Method | 97,946,824 | 48973419 |
DefineProperty (getter) | 90,069,849 | 45034932 |
DefineProperty (getter & enumerable=false) | 52,421,940 | 26210975 |
DefineProperty (getter & configurable=false) | 100,569,791 | 50309062 |
DefineProperty (getter & enumerable=false & configurable=false) | 52,392,813 | 26204187 |
DefineProperty (writable) | 88,445,484 | 44238623 |
DefineProperty (writable & enumerable=false) | 99,814,832 | 49907843 |
DefineProperty (writable & enumerable=false & configurable=false) | 100,306,301 | 50153156 |
DefineProperties (getter) | 52,275,398 | 26137761 |
DefineProperties (getter & enumerable=false) | 50,151,395 | 25075722 |
DefineProperties (getter & enumerable=false & configurable=false) | 51,276,475 | 25638245 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:53:12 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Setter (class) | 137,161,971 | 68587772 |
Setter | 10,527,517 | 5263762 |
Method | 96,767,704 | 48384217 |
DefineProperty (setter) | 101,667,890 | 50838182 |
DefineProperty (setter & enumerable=false) | 10,746,459 | 5373360 |
DefineProperty (setter & configurable=false) | 10,554,131 | 5277223 |
DefineProperty (setter & enumerable=false & configurable=false) | 10,633,629 | 5316817 |
DefineProperty (writable) | 85,477,974 | 42738993 |
DefineProperty (writable & enumerable=false) | 99,929,469 | 49964753 |
DefineProperty (writable & enumerable=false & configurable=false) | 102,969,485 | 51508148 |
DefineProperties (setter) | 94,588,396 | 47305120 |
DefineProperties (setter & enumerable=false) | 10,247,373 | 5124160 |
DefineProperties (setter & enumerable=false & configurable=false) | 10,564,062 | 5282047 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 18:59:55 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Using replace(//g) | 3,355,528 | 1680284 |
Using replaceAll() | 2,850,673 | 1425338 |
Using replaceAll(//g) | 2,880,638 | 1440321 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:05:25 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
{ ...object } | 21,801,506 | 10901717 |
{ ...object, proto: null } | 20,396,555 | 10198400 |
{ ...object, newProp: true } | 832,027 | 417344 |
structuredClone | 282,228 | 141168 |
JSON.parse + JSON.stringify | 189,441 | 94724 |
loop + object.keys starting with {} | 1,519,765 | 761739 |
loop + object.keys starting with { proto: null } | 825,459 | 412746 |
loop + object.keys starting with { randomProp: true } | 606,857 | 303429 |
object.keys + reduce(FN, {}) | 1,553,783 | 776896 |
object.keys + reduce(FN, { proto: null }) | 839,812 | 420268 |
object.keys + reduce(FN, { newProp: true }) | 603,199 | 301600 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:12:08 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Sort using default | 260,828 | 130416 |
Sort using first char | 1,314,441 | 657313 |
Sort using localeCompare | 1,231,980 | 616071 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:17:48 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
{...bigObject} - Total keys: 1000 | 1,830 | 916 |
{...smallObject} - Total keys: 2 | 52,604,953 | 26302479 |
Object.assign({}, bigObject, anotherBigObject) - Total keys: 1000 - creating new object | 1,075 | 538 |
Object.assign(bigObject, anotherBigObject) - mutating bigObject | 6,255 | 3128 |
{ ...bigObject, ...anotherBigObject } | 1,132 | 568 |
Object.assign({}, smallObject, anotherSmallObject) - creating new object | 13,083,950 | 6543279 |
Object.assign(smallObject, anotherSmallObject) - mutating smallObject | 27,966,563 | 13983293 |
{ ...smallObject, ...anotherSmallObject } | 19,691,487 | 9848228 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:23:58 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
streams.Readable reading 1e3 * "some data" | 2,066 | 1034 |
streams.web.Readable reading 1e3 * "some data" | 1,631 | 817 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:29:06 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
streams.Writable writing 1e3 * "some data" | 7,709 | 3883 |
streams.web.WritableStream writing 1e3 * "some data" | 1,344 | 674 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:35:45 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Using + sign | 147,149,157 | 73574648 |
Using backtick (`) | 99,543,128 | 49772167 |
Using array.join | 10,297,759 | 5149287 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:40:45 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
(short string) (true) String#endsWith | 58,271,105 | 29135610 |
(short string) (true) String#slice and strict comparison | 61,066,079 | 30533043 |
(long string) (true) String#endsWith | 49,939,022 | 24973598 |
(long string) (true) String#slice and strict comparison | 55,815,457 | 27909560 |
(short string) (false) String#endsWith | 56,610,848 | 28305802 |
(short string) (false) String#slice and strict comparison | 60,245,761 | 30122886 |
(long string) (false) String#endsWith | 53,708,325 | 26858667 |
(long string) (false) String#slice and strict comparison | 55,342,813 | 27672756 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:47:20 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Using includes | 139,008,515 | 69504300 |
Using indexof | 15,209,156 | 7604580 |
Using RegExp.test | 12,561,162 | 6280583 |
Using RegExp.text with cached regex pattern | 13,492,392 | 6746299 |
Using new RegExp.test | 4,262,539 | 2131502 |
Using new RegExp.test with cached regex pattern | 5,061,726 | 2530903 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:53:08 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
(short string) (true) String#startsWith | 114,299,970 | 57150030 |
(short string) (true) String#slice and strict comparison | 60,068,350 | 30035966 |
(long string) (true) String#startsWith | 60,630,056 | 30315332 |
(long string) (true) String#slice and strict comparison | 54,617,744 | 27309042 |
(short string) (false) String#startsWith | 97,885,755 | 48943436 |
(short string) (false) String#slice and strict comparison | 60,185,785 | 30237981 |
(long string) (false) String#startsWith | 89,080,914 | 44540557 |
(long string) (false) String#slice and strict comparison | 55,365,572 | 27683104 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 19:59:11 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
Using super | 122,079,232 | 61039643 |
Using this | 99,197,628 | 49599680 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 20:08:30 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0
name | ops/sec | samples |
---|---|---|
new Date().getTime() | 10,996,025 | 5498017 |
Date.now() | 19,679,418 | 9841293 |
Environment
- Machine: linux x64 | 4 vCPUs | 7.6GB Mem
- Run: Tue Oct 29 2024 20:13:24 GMT+0000 (Coordinated Universal Time)
- Node:
v20.18.0