name | ops/sec | samples |
---|---|---|
Directly in the object | 16,474,928 | 8237465 |
Using dot notation | 16,519,020 | 8259511 |
Using define property (writable) | 3,345,397 | 1672699 |
Using define property initialized (writable) | 4,290,219 | 2145110 |
Using define property (getter) | 2,080,425 | 1040213 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 18:29:48 GMT+0000 (Coordinated Universal Time)
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.019ms |
new Array(length) | 10 | 0.002ms |
array.push | 100 | 0.099ms |
new Array(length) | 100 | 0.012ms |
array.push | 1,000 | 0.039ms |
new Array(length) | 1,000 | 0.017ms |
array.push | 10,000 | 0.298ms |
new Array(length) | 10,000 | 0.168ms |
array.push | 1,000,000 | 26.143ms |
new Array(length) | 1,000,000 | 17.862ms |
array.push | 100,000,000 | 1,954.795ms |
new Array(length) | 100,000,000 | 4,322.033ms |
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.007ms |
new Array(length) | 10 | 0.003ms |
array.push | 100 | 0.017ms |
new Array(length) | 100 | 0.011ms |
array.push | 1,000 | 0.04ms |
new Array(length) | 1,000 | 0.021ms |
array.push | 10,000 | 0.306ms |
new Array(length) | 10,000 | 0.203ms |
array.push | 1,000,000 | 19.796ms |
new Array(length) | 1,000,000 | 7.576ms |
array.push | 100,000,000 | 2,116.504ms |
new Array(length) | 100,000,000 | 4,911.252ms |
name | ops/sec | samples |
---|---|---|
new Array | 230 | 116 |
Array.from | 23 | 12 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 18:51:56 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
[True conditional] Using instanceof only | 315,821 | 157911 |
[True conditional] Using constructor name | 322,054 | 161028 |
[True conditional] Check if property is valid then instanceof | 325,660 | 162831 |
[False conditional] Using instanceof only | 16,429,710 | 8214856 |
[False conditional] Using constructor name | 16,563,222 | 8281612 |
[False conditional] Check if property is valid then instanceof | 16,524,490 | 8262246 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 15:49:09 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
crypto.createVerify('RSA-SHA256') | 6,629 | 3315 |
crypto.verify('RSA-SHA256') | 6,831 | 3416 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 15:54:44 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using String() | 1,016,084 | 508043 |
Using brackets {} | 1,052,606 | 526304 |
Using '' + | 1,052,764 | 526383 |
Using date.toString() | 1,173,488 | 586745 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 16:10:10 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using delete property | 3,283,967 | 1641984 |
Using delete property (proto: null) | 9,050,929 | 4525465 |
Using delete property (cached proto: null) | 3,269,238 | 1634620 |
Using undefined assignment | 16,554,281 | 8277141 |
Using undefined assignment (proto: null) | 9,450,096 | 4725049 |
Using undefined property (cached proto: null) | 16,548,120 | 8274061 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 21:22:38 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Error | 306,392 | 153197 |
NodeError | 304,201 | 152101 |
NodeError Range | 310,812 | 155407 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 21:28:55 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Function returning null | 1,611,843 | 805922 |
Function returning explicitly undefined | 1,599,497 | 799749 |
Function returning implicitly undefined | 1,633,553 | 816777 |
Function returning string | 1,575,682 | 787842 |
Function returning integer | 1,643,710 | 821856 |
Function returning float | 1,623,868 | 811935 |
Function returning functions | 1,573,396 | 786699 |
Function returning arrow functions | 1,603,141 | 801571 |
Function returning empty object | 1,618,937 | 809469 |
Function returning empty array | 1,590,523 | 795262 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 21:34:59 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
using Array.includes | 16,464,949 | 8232475 |
using Array.includes (first item) | 16,516,749 | 8258375 |
Using raw comparison | 16,499,465 | 8249733 |
Using raw comparison (first item) | 16,525,302 | 8262652 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 21:42:47 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using Object.keys() | 13,712,878 | 6856440 |
Using Object.getOwnPropertyNames() | 14,541,635 | 7270818 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 21:49:41 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Length = 100 - Array.at | 16,226,035 | 8113018 |
Length = 10_000 - Array.at | 16,288,002 | 8144002 |
Length = 1_000_000 - Array.at | 16,352,996 | 8176499 |
Length = 100 - Array[length - 1] | 16,284,992 | 8142497 |
Length = 10_000 - Array[length - 1] | 16,259,356 | 8129679 |
Length = 1_000_000 - Array[length - 1] | 16,286,055 | 8143028 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 21:57:39 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Object.create(null) | 12,919,273 | 6459637 |
Object.create({}) | 1,855,643 | 927822 |
Cached Empty.prototype | 16,352,228 | 8176115 |
Empty.prototype | 1,865,039 | 932520 |
Empty class | 1,252,707 | 626354 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:06:33 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using optional chain (obj.field?.field2) (Valid) | 16,502,256 | 8251129 |
Using optional chain (obj.field?.field2) (undefined) | 16,571,001 | 8285501 |
Using and operator (obj.field && obj.field.field2) (Valid) | 16,565,117 | 8282559 |
Using and operator (obj.field && obj.field.field2) (undefined) | 16,619,824 | 8309913 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:14:26 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using parseInt(x, 10) - small number (2 len) | 16,531,374 | 8265688 |
Using parseInt(x, 10) - big number (10 len) | 16,530,874 | 8265438 |
Using + - small number (2 len) | 16,546,447 | 8273224 |
Using + - big number (10 len) | 16,577,468 | 8288735 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:22:23 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using if to check function existence | 1,097,886 | 548944 |
Using ? operator to avoid rejection | 1,100,652 | 550327 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:27:56 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Raw usage private field | 16,466,371 | 8233186 |
Raw usage underscore usage | 16,433,279 | 8216640 |
Manipulating private properties using # | 16,483,245 | 8241623 |
Manipulating private properties using underscore(_) | 16,512,292 | 8256147 |
Manipulating private properties using Symbol | 16,463,103 | 8231552 |
Manipulating private properties using PrivateSymbol | 11,957,641 | 5978821 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:35:34 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Adding property after object creation - small object | 3,932,181 | 1966091 |
Adding property in the object creation - small object | 3,944,214 | 1972108 |
Adding property after the function creation - small class | 270,005 | 135003 |
Adding property in the function creation - small class | 258,766 | 129384 |
Adding property after the class creation - small class | 273,437 | 136719 |
Adding property in the class creation - small class | 261,847 | 130924 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:42:57 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Getter (class) | 16,490,182 | 8245092 |
Getter | 13,860,676 | 6930339 |
Method | 16,392,167 | 8196084 |
DefineProperty (getter) | 16,324,605 | 8162303 |
DefineProperty (getter & enumerable=false) | 13,855,641 | 6927821 |
DefineProperty (getter & configurable=false) | 16,516,760 | 8258381 |
DefineProperty (getter & enumerable=false & configurable=false) | 13,739,464 | 6869733 |
DefineProperty (writable) | 16,313,963 | 8156982 |
DefineProperty (writable & enumerable=false) | 16,338,304 | 8169153 |
DefineProperty (writable & enumerable=false & configurable=false) | 16,442,000 | 8221001 |
DefineProperties (getter) | 12,776,139 | 6388070 |
DefineProperties (getter & enumerable=false) | 13,802,180 | 6901091 |
DefineProperties (getter & enumerable=false & configurable=false) | 13,749,801 | 6874901 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:55:07 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Setter (class) | 16,386,771 | 8193386 |
Setter | 6,741,587 | 3370794 |
Method | 16,296,630 | 8148316 |
DefineProperty (setter) | 16,303,921 | 8151961 |
DefineProperty (setter & enumerable=false) | 6,708,281 | 3354141 |
DefineProperty (setter & configurable=false) | 6,776,614 | 3388308 |
DefineProperty (setter & enumerable=false & configurable=false) | 6,834,043 | 3417022 |
DefineProperty (writable) | 16,353,826 | 8176914 |
DefineProperty (writable & enumerable=false) | 16,314,836 | 8157419 |
DefineProperty (writable & enumerable=false & configurable=false) | 16,093,179 | 8046590 |
DefineProperties (setter) | 16,316,163 | 8158082 |
DefineProperties (setter & enumerable=false) | 6,592,265 | 3296133 |
DefineProperties (setter & enumerable=false & configurable=false) | 6,819,070 | 3409536 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 23:12:13 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
{ ...object } | 9,954,997 | 4977499 |
{ ...object, proto: null } | 2,226,060 | 1113031 |
{ ...object, newProp: true } | 10,011,808 | 5005905 |
structuredClone | 277,320 | 138661 |
JSON.parse + JSON.stringify | 249,426 | 124714 |
loop + object.keys starting with {} | 1,413,122 | 706562 |
loop + object.keys starting with { proto: null } | 812,495 | 406248 |
loop + object.keys starting with { randomProp: true } | 653,118 | 326560 |
object.keys + reduce(FN, {}) | 1,469,486 | 734744 |
object.keys + reduce(FN, { proto: null }) | 827,922 | 413962 |
object.keys + reduce(FN, { newProp: true }) | 671,880 | 335941 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 23:26:56 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Sort using default | 339,627 | 169814 |
Sort using first char | 1,314,199 | 657100 |
Sort using localeCompare | 1,235,449 | 617725 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 23:33:42 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
{...bigObject} - Total keys: 1000 | 2,236 | 1119 |
{...smallObject} - Total keys: 2 | 13,137,182 | 6568592 |
Object.assign({}, bigObject, anotherBigObject) - Total keys: 1000 - creating new object | 2,362 | 1182 |
Object.assign(bigObject, anotherBigObject) - mutating bigObject | 6,645 | 3323 |
{ ...bigObject, ...anotherBigObject } | 1,363 | 682 |
Object.assign({}, smallObject, anotherSmallObject) - creating new object | 6,789,657 | 3394829 |
Object.assign(smallObject, anotherSmallObject) - mutating smallObject | 10,797,458 | 5398730 |
{ ...smallObject, ...anotherSmallObject } | 9,030,279 | 4515140 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 23:42:05 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using + sign | 16,239,840 | 8119921 |
Using backtick (`) | 16,400,717 | 8200359 |
Using array.join | 6,510,987 | 3255494 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 23:59:34 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
(short string) (true) String#endsWith | 15,422,273 | 7711137 |
(short string) (true) String#slice and strict comparison | 16,259,078 | 8129540 |
(long string) (true) String#endsWith | 13,827,360 | 6913681 |
(long string) (true) String#slice and strict comparison | 16,125,829 | 8062915 |
(short string) (false) String#endsWith | 15,752,731 | 7876366 |
(short string) (false) String#slice and strict comparison | 16,250,547 | 8125274 |
(long string) (false) String#endsWith | 15,799,782 | 7899892 |
(long string) (false) String#slice and strict comparison | 16,297,757 | 8148879 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Fri May 10 2024 00:12:13 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using includes | 16,276,166 | 8138084 |
Using indexof | 16,271,955 | 8135978 |
Using RegExp.test | 7,498,718 | 3749360 |
Using RegExp.text with cached regex pattern | 8,568,436 | 4284219 |
Using new RegExp.test | 3,558,142 | 1779072 |
Using new RegExp.test with cached regex pattern | 3,830,290 | 1915146 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Fri May 10 2024 00:21:34 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
(short string) (true) String#startsWith | 15,714,467 | 7857234 |
(short string) (true) String#slice and strict comparison | 16,572,255 | 8286128 |
(long string) (true) String#startsWith | 14,270,536 | 7135269 |
(long string) (true) String#slice and strict comparison | 16,259,171 | 8129586 |
(short string) (false) String#startsWith | 15,856,209 | 7928106 |
(short string) (false) String#slice and strict comparison | 16,448,212 | 8224107 |
(long string) (false) String#startsWith | 16,009,724 | 8004863 |
(long string) (false) String#slice and strict comparison | 16,517,752 | 8258877 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Fri May 10 2024 00:31:29 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using super | 16,006,487 | 8003244 |
Using this | 16,433,671 | 8216836 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Fri May 10 2024 00:40:19 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
new Date().getTime() | 6,632,200 | 3316101 |
Date.now() | 9,303,032 | 4651517 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Fri May 10 2024 00:45:40 GMT+0000 (Coordinated Universal Time)