name | ops/sec | samples |
---|---|---|
Directly in the object | 16,939,761 | 8469881 |
Using dot notation | 16,991,364 | 8495683 |
Using define property (writable) | 3,294,047 | 1647024 |
Using define property initialized (writable) | 4,085,194 | 2042598 |
Using define property (getter) | 2,052,606 | 1026304 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 18:25:41 GMT+0000 (Coordinated Universal Time)
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.011ms |
new Array(length) | 10 | 0.002ms |
array.push | 100 | 0.024ms |
new Array(length) | 100 | 0.01ms |
array.push | 1,000 | 0.044ms |
new Array(length) | 1,000 | 0.022ms |
array.push | 10,000 | 0.379ms |
new Array(length) | 10,000 | 0.156ms |
array.push | 1,000,000 | 25.94ms |
new Array(length) | 1,000,000 | 15.262ms |
array.push | 100,000,000 | 2,199.461ms |
new Array(length) | 100,000,000 | 4,236.664ms |
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.006ms |
new Array(length) | 10 | 0.016ms |
array.push | 100 | 0.013ms |
new Array(length) | 100 | 0.009ms |
array.push | 1,000 | 0.043ms |
new Array(length) | 1,000 | 0.024ms |
array.push | 10,000 | 0.459ms |
new Array(length) | 10,000 | 3.08ms |
array.push | 1,000,000 | 253.067ms |
new Array(length) | 1,000,000 | 4.575ms |
array.push | 100,000,000 | 2,600.14ms |
new Array(length) | 100,000,000 | 4,630.325ms |
name | ops/sec | samples |
---|---|---|
new Array | 229 | 115 |
Array.from | 22 | 12 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 18:50:13 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
[True conditional] Using instanceof only | 308,926 | 154464 |
[True conditional] Using constructor name | 303,606 | 151804 |
[True conditional] Check if property is valid then instanceof | 308,166 | 154084 |
[False conditional] Using instanceof only | 12,323,552 | 6161777 |
[False conditional] Using constructor name | 16,171,625 | 8085813 |
[False conditional] Check if property is valid then instanceof | 16,168,769 | 8084385 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 15:46:18 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
crypto.createVerify('RSA-SHA256') | 6,812 | 3407 |
crypto.verify('RSA-SHA256') | 6,751 | 3376 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 15:54:04 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using String() | 1,071,722 | 535862 |
Using brackets {} | 1,086,656 | 543329 |
Using '' + | 1,074,277 | 537139 |
Using date.toString() | 1,171,643 | 585822 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 16:08:17 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using delete property | 2,873,402 | 1436702 |
Using delete property (proto: null) | 8,286,215 | 4143108 |
Using delete property (cached proto: null) | 2,904,058 | 1452030 |
Using undefined assignment | 15,246,729 | 7623365 |
Using undefined assignment (proto: null) | 9,032,064 | 4516033 |
Using undefined property (cached proto: null) | 15,279,532 | 7639767 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 21:19:16 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Error | 299,157 | 149579 |
NodeError | 296,979 | 148490 |
NodeError Range | 305,280 | 152641 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 21:26:41 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Function returning null | 1,532,370 | 766186 |
Function returning explicitly undefined | 1,455,669 | 727835 |
Function returning implicitly undefined | 1,481,147 | 740574 |
Function returning string | 1,466,044 | 733023 |
Function returning integer | 1,482,180 | 741091 |
Function returning float | 1,453,744 | 726873 |
Function returning functions | 1,420,435 | 710218 |
Function returning arrow functions | 1,454,915 | 727458 |
Function returning empty object | 1,445,977 | 722989 |
Function returning empty array | 1,478,348 | 739175 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 21:33:00 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
using Array.includes | 17,167,493 | 8583747 |
using Array.includes (first item) | 16,400,697 | 8200349 |
Using raw comparison | 17,119,705 | 8559853 |
Using raw comparison (first item) | 17,206,260 | 8603131 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 21:38:37 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using Object.keys() | 13,922,457 | 6961229 |
Using Object.getOwnPropertyNames() | 13,587,074 | 6793538 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 21:46:59 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Length = 100 - Array.at | 8,760,348 | 4380175 |
Length = 10_000 - Array.at | 9,220,929 | 4610465 |
Length = 1_000_000 - Array.at | 9,219,635 | 4609818 |
Length = 100 - Array[length - 1] | 16,605,450 | 8302726 |
Length = 10_000 - Array[length - 1] | 16,361,477 | 8180739 |
Length = 1_000_000 - Array[length - 1] | 16,408,726 | 8204364 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 21:53:01 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Object.create(null) | 13,108,335 | 6554168 |
Object.create({}) | 1,478,525 | 739265 |
Cached Empty.prototype | 16,924,559 | 8462280 |
Empty.prototype | 1,516,640 | 758321 |
Empty class | 1,016,983 | 508492 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:03:24 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using optional chain (obj.field?.field2) (Valid) | 17,074,244 | 8537123 |
Using optional chain (obj.field?.field2) (undefined) | 16,979,253 | 8489627 |
Using and operator (obj.field && obj.field.field2) (Valid) | 17,014,893 | 8507447 |
Using and operator (obj.field && obj.field.field2) (undefined) | 17,053,868 | 8526935 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:11:25 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using parseInt(x, 10) - small number (2 len) | 16,773,711 | 8386856 |
Using parseInt(x, 10) - big number (10 len) | 8,717,140 | 4358571 |
Using + - small number (2 len) | 16,441,288 | 8220645 |
Using + - big number (10 len) | 16,420,978 | 8210490 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:18:48 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using if to check function existence | 729,969 | 376748 |
Using ? operator to avoid rejection | 797,149 | 398575 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:26:55 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Raw usage private field | 16,203,906 | 8101954 |
Raw usage underscore usage | 16,049,415 | 8024708 |
Manipulating private properties using # | 14,479,194 | 7239734 |
Manipulating private properties using underscore(_) | 14,034,063 | 7017032 |
Manipulating private properties using Symbol | 14,836,033 | 7418017 |
Manipulating private properties using PrivateSymbol | 10,613,013 | 5306507 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:31:51 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Adding property after object creation - small object | 2,912,868 | 1456435 |
Adding property in the object creation - small object | 2,906,996 | 1453499 |
Adding property after the function creation - small class | 211,279 | 105640 |
Adding property in the function creation - small class | 219,056 | 109530 |
Adding property after the class creation - small class | 180,662 | 90332 |
Adding property in the class creation - small class | 180,217 | 90109 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:40:58 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Getter (class) | 16,341,100 | 8170551 |
Getter | 14,159,022 | 7079512 |
Method | 16,569,268 | 8284635 |
DefineProperty (getter) | 16,461,087 | 8230544 |
DefineProperty (getter & enumerable=false) | 13,861,744 | 6930873 |
DefineProperty (getter & configurable=false) | 16,690,327 | 8345164 |
DefineProperty (getter & enumerable=false & configurable=false) | 14,012,608 | 7006305 |
DefineProperty (writable) | 16,396,668 | 8198335 |
DefineProperty (writable & enumerable=false) | 17,157,603 | 8578802 |
DefineProperty (writable & enumerable=false & configurable=false) | 17,201,763 | 8600882 |
DefineProperties (getter) | 13,763,595 | 6881798 |
DefineProperties (getter & enumerable=false) | 13,766,879 | 6883440 |
DefineProperties (getter & enumerable=false & configurable=false) | 14,051,472 | 7025737 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 22:47:17 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Setter (class) | 16,839,349 | 8419675 |
Setter | 6,131,888 | 3065945 |
Method | 16,209,950 | 8104976 |
DefineProperty (setter) | 16,014,376 | 8007189 |
DefineProperty (setter & enumerable=false) | 6,160,452 | 3080227 |
DefineProperty (setter & configurable=false) | 6,245,057 | 3122530 |
DefineProperty (setter & enumerable=false & configurable=false) | 5,896,263 | 2948132 |
DefineProperty (writable) | 15,535,315 | 7767658 |
DefineProperty (writable & enumerable=false) | 15,533,474 | 7766738 |
DefineProperty (writable & enumerable=false & configurable=false) | 15,571,324 | 7785663 |
DefineProperties (setter) | 16,767,062 | 8383532 |
DefineProperties (setter & enumerable=false) | 6,242,392 | 3121197 |
DefineProperties (setter & enumerable=false & configurable=false) | 6,165,505 | 3082753 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 23:07:08 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
{ ...object } | 10,304,558 | 5152280 |
{ ...object, proto: null } | 10,614,453 | 5307227 |
{ ...object, newProp: true } | 602,119 | 301550 |
structuredClone | 269,704 | 134853 |
JSON.parse + JSON.stringify | 187,642 | 93822 |
loop + object.keys starting with {} | 1,169,998 | 585000 |
loop + object.keys starting with { proto: null } | 739,087 | 369544 |
loop + object.keys starting with { randomProp: true } | 552,038 | 276020 |
object.keys + reduce(FN, {}) | 1,197,894 | 598948 |
object.keys + reduce(FN, { proto: null }) | 746,665 | 373333 |
object.keys + reduce(FN, { newProp: true }) | 557,191 | 278597 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 23:23:37 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Sort using default | 276,187 | 138094 |
Sort using first char | 1,201,791 | 600896 |
Sort using localeCompare | 1,152,474 | 576238 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 23:31:53 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
{...bigObject} - Total keys: 1000 | 2,186 | 1094 |
{...smallObject} - Total keys: 2 | 13,567,651 | 6783826 |
Object.assign({}, bigObject, anotherBigObject) - Total keys: 1000 - creating new object | 2,435 | 1218 |
Object.assign(bigObject, anotherBigObject) - mutating bigObject | 6,504 | 3253 |
{ ...bigObject, ...anotherBigObject } | 1,299 | 650 |
Object.assign({}, smallObject, anotherSmallObject) - creating new object | 6,552,010 | 3276006 |
Object.assign(smallObject, anotherSmallObject) - mutating smallObject | 10,787,125 | 5393563 |
{ ...smallObject, ...anotherSmallObject } | 9,372,528 | 4686265 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 23:39:12 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using + sign | 16,870,620 | 8435311 |
Using backtick (`) | 17,002,751 | 8501376 |
Using array.join | 6,090,271 | 3045136 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Thu May 09 2024 23:58:33 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
(short string) (true) String#endsWith | 13,486,829 | 6743415 |
(short string) (true) String#slice and strict comparison | 17,310,203 | 8655102 |
(long string) (true) String#endsWith | 13,569,254 | 6784628 |
(long string) (true) String#slice and strict comparison | 15,993,587 | 7996794 |
(short string) (false) String#endsWith | 14,140,092 | 7070047 |
(short string) (false) String#slice and strict comparison | 16,148,292 | 8074147 |
(long string) (false) String#endsWith | 13,976,541 | 6988271 |
(long string) (false) String#slice and strict comparison | 16,272,510 | 8136256 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Fri May 10 2024 00:07:25 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using includes | 17,260,312 | 8630157 |
Using indexof | 17,233,824 | 8616913 |
Using RegExp.test | 8,176,747 | 4088374 |
Using RegExp.text with cached regex pattern | 8,633,317 | 4316659 |
Using new RegExp.test | 3,036,810 | 1518406 |
Using new RegExp.test with cached regex pattern | 3,186,542 | 1593272 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Fri May 10 2024 00:19:02 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
(short string) (true) String#startsWith | 15,112,195 | 7556098 |
(short string) (true) String#slice and strict comparison | 17,075,396 | 8537699 |
(long string) (true) String#startsWith | 14,435,171 | 7217586 |
(long string) (true) String#slice and strict comparison | 15,901,506 | 7950754 |
(short string) (false) String#startsWith | 16,003,285 | 8001643 |
(short string) (false) String#slice and strict comparison | 16,599,503 | 8299752 |
(long string) (false) String#startsWith | 15,717,258 | 7858630 |
(long string) (false) String#slice and strict comparison | 16,571,501 | 8285751 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Fri May 10 2024 00:27:02 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using super | 15,899,062 | 7949655 |
Using this | 15,409,177 | 7704589 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Fri May 10 2024 00:37:38 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
new Date().getTime() | 6,388,841 | 3194421 |
Date.now() | 8,953,626 | 4476814 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Fri May 10 2024 00:44:09 GMT+0000 (Coordinated Universal Time)