name | ops/sec | samples |
---|---|---|
Directly in the object | 15,213,667 | 7606834 |
Using dot notation | 15,200,001 | 7600001 |
Using define property (writable) | 3,301,688 | 1650845 |
Using define property initialized (writable) | 4,185,349 | 2092675 |
Using define property (getter) | 2,233,480 | 1116741 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 18:30:52 GMT+0000 (Coordinated Universal Time)
type | amount | time elapsed |
---|---|---|
array.push | 10 | 0.004ms |
new Array(length) | 10 | 0.001ms |
array.push | 100 | 0.021ms |
new Array(length) | 100 | 0.012ms |
array.push | 1,000 | 0.031ms |
new Array(length) | 1,000 | 0.015ms |
array.push | 10,000 | 0.268ms |
new Array(length) | 10,000 | 0.165ms |
array.push | 1,000,000 | 31.021ms |
new Array(length) | 1,000,000 | 7.99ms |
array.push | 100,000,000 | 1,926.186ms |
new Array(length) | 100,000,000 | 4,163.703ms |
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.011ms |
array.push | 1,000 | 0.039ms |
new Array(length) | 1,000 | 0.021ms |
array.push | 10,000 | 0.327ms |
new Array(length) | 10,000 | 0.2ms |
array.push | 1,000,000 | 21.771ms |
new Array(length) | 1,000,000 | 8.102ms |
array.push | 100,000,000 | 2,140.578ms |
new Array(length) | 100,000,000 | 4,803.947ms |
name | ops/sec | samples |
---|---|---|
new Array | 237 | 119 |
Array.from | 23 | 12 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 18:52:36 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
[True conditional] Using instanceof only | 314,311 | 157156 |
[True conditional] Using constructor name | 325,194 | 162598 |
[True conditional] Check if property is valid then instanceof | 332,029 | 166015 |
[False conditional] Using instanceof only | 15,204,959 | 7602480 |
[False conditional] Using constructor name | 15,240,681 | 7620342 |
[False conditional] Check if property is valid then instanceof | 15,280,638 | 7640320 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 16:44:18 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
crypto.createVerify('RSA-SHA256') | 7,062 | 3532 |
crypto.verify('RSA-SHA256') | 7,234 | 3618 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 16:45:28 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using String() | 1,047,862 | 523932 |
Using brackets {} | 1,088,890 | 544446 |
Using '' + | 1,080,410 | 540206 |
Using date.toString() | 1,197,806 | 598904 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 16:50:00 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using delete property | 3,256,232 | 1628117 |
Using delete property (proto: null) | 8,959,913 | 4479957 |
Using delete property (cached proto: null) | 3,119,534 | 1559768 |
Using undefined assignment | 15,407,776 | 7703889 |
Using undefined assignment (proto: null) | 9,495,478 | 4747740 |
Using undefined property (cached proto: null) | 15,291,161 | 7645581 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 16:53:13 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Error | 297,169 | 148585 |
NodeError | 292,862 | 146432 |
NodeError Range | 300,172 | 150087 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 16:54:18 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Function returning null | 1,655,530 | 827766 |
Function returning explicitly undefined | 1,634,714 | 817358 |
Function returning implicitly undefined | 1,664,746 | 832378 |
Function returning string | 1,612,879 | 806440 |
Function returning integer | 1,665,229 | 832615 |
Function returning float | 1,635,634 | 817818 |
Function returning functions | 1,601,949 | 800975 |
Function returning arrow functions | 1,604,881 | 802441 |
Function returning empty object | 1,634,527 | 817264 |
Function returning empty array | 1,620,381 | 810191 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 16:56:05 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
using Array.includes | 15,202,932 | 7601467 |
using Array.includes (first item) | 15,209,171 | 7604586 |
Using raw comparison | 15,186,306 | 7593154 |
Using raw comparison (first item) | 15,235,181 | 7617591 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 16:58:44 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using Object.keys() | 13,199,625 | 6599813 |
Using Object.getOwnPropertyNames() | 13,215,145 | 6607573 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 16:59:45 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Length = 100 - Array.at | 15,042,685 | 7521343 |
Length = 10_000 - Array.at | 15,110,942 | 7555472 |
Length = 1_000_000 - Array.at | 15,149,506 | 7574754 |
Length = 100 - Array[length - 1] | 15,071,709 | 7535855 |
Length = 10_000 - Array[length - 1] | 15,123,403 | 7561702 |
Length = 1_000_000 - Array[length - 1] | 15,097,466 | 7548734 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:03:19 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Object.create(null) | 12,701,664 | 6350833 |
Object.create({}) | 1,938,351 | 969182 |
Cached Empty.prototype | 15,099,375 | 7549688 |
Empty.prototype | 2,120,079 | 1060044 |
Empty class | 1,323,167 | 661584 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:04:42 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using optional chain (obj.field?.field2) (Valid) | 15,145,834 | 7572919 |
Using optional chain (obj.field?.field2) (undefined) | 15,176,166 | 7588084 |
Using and operator (obj.field && obj.field.field2) (Valid) | 15,213,603 | 7606802 |
Using and operator (obj.field && obj.field.field2) (undefined) | 15,259,820 | 7629911 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:06:54 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using parseInt(x, 10) - small number (2 len) | 15,243,681 | 7621841 |
Using parseInt(x, 10) - big number (10 len) | 15,238,506 | 7619254 |
Using + - small number (2 len) | 15,246,900 | 7623451 |
Using + - big number (10 len) | 15,244,565 | 7622283 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:08:31 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using if to check function existence | 1,139,822 | 569912 |
Using ? operator to avoid rejection | 1,125,317 | 562659 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:10:47 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Raw usage private field | 14,768,999 | 7384500 |
Raw usage underscore usage | 14,898,631 | 7449317 |
Manipulating private properties using # | 14,958,599 | 7479300 |
Manipulating private properties using underscore(_) | 14,916,192 | 7458097 |
Manipulating private properties using Symbol | 14,959,280 | 7479641 |
Manipulating private properties using PrivateSymbol | 12,160,257 | 6080129 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:13:14 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Adding property after object creation - small object | 3,753,155 | 1876578 |
Adding property in the object creation - small object | 3,794,957 | 1897479 |
Adding property after the function creation - small class | 265,971 | 132986 |
Adding property in the function creation - small class | 281,229 | 140615 |
Adding property after the class creation - small class | 273,704 | 136853 |
Adding property in the class creation - small class | 263,202 | 131602 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:15:55 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Getter (class) | 15,232,837 | 7616419 |
Getter | 13,318,811 | 6659406 |
Method | 15,261,160 | 7630581 |
DefineProperty (getter) | 15,259,185 | 7629593 |
DefineProperty (getter & enumerable=false) | 13,319,534 | 6659768 |
DefineProperty (getter & configurable=false) | 15,311,462 | 7655732 |
DefineProperty (getter & enumerable=false & configurable=false) | 13,330,883 | 6665442 |
DefineProperty (writable) | 15,296,377 | 7648189 |
DefineProperty (writable & enumerable=false) | 15,291,267 | 7645634 |
DefineProperty (writable & enumerable=false & configurable=false) | 15,277,680 | 7638841 |
DefineProperties (getter) | 13,292,623 | 6646312 |
DefineProperties (getter & enumerable=false) | 13,358,876 | 6679439 |
DefineProperties (getter & enumerable=false & configurable=false) | 13,344,769 | 6672385 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:18:33 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Setter (class) | 15,040,335 | 7520168 |
Setter | 6,845,937 | 3422969 |
Method | 15,094,523 | 7547262 |
DefineProperty (setter) | 15,065,769 | 7532885 |
DefineProperty (setter & enumerable=false) | 6,801,939 | 3400970 |
DefineProperty (setter & configurable=false) | 6,749,350 | 3374676 |
DefineProperty (setter & enumerable=false & configurable=false) | 6,783,788 | 3391895 |
DefineProperty (writable) | 15,067,285 | 7533643 |
DefineProperty (writable & enumerable=false) | 15,106,583 | 7553292 |
DefineProperty (writable & enumerable=false & configurable=false) | 15,105,445 | 7552723 |
DefineProperties (setter) | 15,106,158 | 7553080 |
DefineProperties (setter & enumerable=false) | 6,728,232 | 3364117 |
DefineProperties (setter & enumerable=false & configurable=false) | 6,725,619 | 3362810 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:23:03 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
{ ...object } | 10,212,001 | 5106001 |
{ ...object, proto: null } | 2,218,291 | 1109146 |
{ ...object, newProp: true } | 9,830,326 | 4915164 |
structuredClone | 278,517 | 139259 |
JSON.parse + JSON.stringify | 249,025 | 124513 |
loop + object.keys starting with {} | 1,427,918 | 713960 |
loop + object.keys starting with { proto: null } | 818,010 | 409006 |
loop + object.keys starting with { randomProp: true } | 653,085 | 326543 |
object.keys + reduce(FN, {}) | 1,471,564 | 735783 |
object.keys + reduce(FN, { proto: null }) | 830,504 | 415253 |
object.keys + reduce(FN, { newProp: true }) | 666,013 | 333007 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:26:36 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Sort using default | 326,186 | 163094 |
Sort using first char | 1,344,727 | 672364 |
Sort using localeCompare | 1,295,383 | 647692 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:29:28 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
{...bigObject} - Total keys: 1000 | 2,320 | 1161 |
{...smallObject} - Total keys: 2 | 12,277,303 | 6138652 |
Object.assign({}, bigObject, anotherBigObject) - Total keys: 1000 - creating new object | 2,467 | 1234 |
Object.assign(bigObject, anotherBigObject) - mutating bigObject | 6,795 | 3398 |
{ ...bigObject, ...anotherBigObject } | 1,392 | 697 |
Object.assign({}, smallObject, anotherSmallObject) - creating new object | 7,086,912 | 3543457 |
Object.assign(smallObject, anotherSmallObject) - mutating smallObject | 10,641,452 | 5320727 |
{ ...smallObject, ...anotherSmallObject } | 9,147,047 | 4573524 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:30:56 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using + sign | 15,092,581 | 7546291 |
Using backtick (`) | 15,234,371 | 7617186 |
Using array.join | 6,265,793 | 3134682 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:36:12 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
(short string) (true) String#endsWith | 14,477,157 | 7238579 |
(short string) (true) String#slice and strict comparison | 15,069,165 | 7534583 |
(long string) (true) String#endsWith | 14,054,654 | 7027328 |
(long string) (true) String#slice and strict comparison | 15,213,110 | 7606556 |
(short string) (false) String#endsWith | 15,058,395 | 7529198 |
(short string) (false) String#slice and strict comparison | 15,103,870 | 7551936 |
(long string) (false) String#endsWith | 14,647,118 | 7323560 |
(long string) (false) String#slice and strict comparison | 15,167,030 | 7583516 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:39:19 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using includes | 15,164,488 | 7582245 |
Using indexof | 15,213,527 | 7606764 |
Using RegExp.test | 7,840,876 | 3920439 |
Using RegExp.text with cached regex pattern | 7,855,721 | 3927861 |
Using new RegExp.test | 3,576,048 | 1788025 |
Using new RegExp.test with cached regex pattern | 3,793,856 | 1896929 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:41:16 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
(short string) (true) String#startsWith | 14,501,577 | 7250789 |
(short string) (true) String#slice and strict comparison | 14,579,626 | 7289814 |
(long string) (true) String#startsWith | 14,077,827 | 7038914 |
(long string) (true) String#slice and strict comparison | 15,166,929 | 7583465 |
(short string) (false) String#startsWith | 15,199,994 | 7599998 |
(short string) (false) String#slice and strict comparison | 15,395,220 | 7697611 |
(long string) (false) String#startsWith | 14,986,963 | 7493482 |
(long string) (false) String#slice and strict comparison | 15,439,928 | 7719965 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:44:50 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
Using super | 14,902,405 | 7451203 |
Using this | 15,063,631 | 7531816 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:47:41 GMT+0000 (Coordinated Universal Time)
name | ops/sec | samples |
---|---|---|
new Date().getTime() | 6,788,392 | 3394197 |
Date.now() | 9,030,834 | 4515418 |
Environment
- Machine: linux x64 | 4 vCPUs | 15.2GB Mem
- Run: Mon May 13 2024 17:49:14 GMT+0000 (Coordinated Universal Time)