Skip to content

Latest commit

 

History

History
722 lines (525 loc) · 34.5 KB

File metadata and controls

722 lines (525 loc) · 34.5 KB

Adding property

name ops/sec samples
Directly in the object 104,684,938 52386528
Using dot notation 78,224,394 39112205
Using define property (writable) 5,010,737 2506401
Using define property initialized (writable) 7,123,149 3561577
Using define property (getter) 2,403,071 1201658
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:14:53 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Array Creation

name ops/sec samples
new Array 323 162
Array.from 23 12
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:16:50 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Blob

name ops/sec samples
new Blob (128) 4,668 2336
new Blob (1024) 633 317
text (128) 4,442 2224
text (1024) 551 277
arrayBuffer (128) 4,370 2188
arrayBuffer (1024) 555 279
slice (0, 64) 165,577 82791
slice (0, 512) 20,058 11508
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:18:27 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Compression algorithms

name total time samples
Deflate 132.73 ms 1
Gzip 134.34 ms 1
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:19:58 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Crypto Verify

name ops/sec samples
crypto.createVerify('RSA-SHA256') 6,910 3456
crypto.verify('RSA-SHA256') 6,847 3424
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:20:34 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Date toISOString

name ops/sec samples
new Date().toISOString() 1,552,070 776048
fromUnixToISOString(new Date()) 2,703,936 1351969
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:21:37 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Date format MM/DD/YYYY

name ops/sec samples
Intl.DateTimeFormat().format(Date.now()) 22,061 11031
Intl.DateTimeFormat().format(new Date()) 21,772 10887
Intl.DateTimeFormat(undefined, twoDigitsLocaleOptions).format(Date.now()) 21,365 10683
Intl.DateTimeFormat(undefined, twoDigitsLocaleOptions).format(new Date()) 20,501 10254
Reusing Intl.DateTimeFormat() 461,849 230931
Date.toLocaleDateString() 1,042,457 521233
Date.toLocaleDateString(undefined, twoDigitsLocaleOptions) 26,447 13225
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:22:21 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Date String coersion

name ops/sec samples
Using String() 1,058,349 529569
Using brackets {} 1,077,084 539508
Using '' + 1,119,405 559707
Using date.toString() 1,246,746 623379
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:23:43 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Deleting properties

name ops/sec samples
Using delete property 4,093,705 2046854
Using delete property (proto: null) 17,036,330 8518169
Using delete property (cached proto: null) 4,215,323 2107664
Using undefined assignment 77,711,320 38857642
Using undefined assignment (proto: null) 20,000,835 10000421
Using undefined property (cached proto: null) 76,871,237 38441839
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:24:46 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Node.js Error

name ops/sec samples
Error 357,447 178724
NodeError 323,585 161795
NodeError Range 313,436 156957
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:26:03 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Array.includes vs raw comparison

name ops/sec samples
using Array.includes 69,147,832 34580204
using Array.includes (first item) 77,276,406 38641487
Using raw comparison 96,899,756 48450421
Using raw comparison (first item) 96,899,156 48449583
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:26:44 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Object.keys vs Object.getOwnPropertyNames comparison

name ops/sec samples
Using Object.keys() 40,974,287 20492970
Using Object.getOwnPropertyNames() 46,301,384 23150694
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:27:46 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Get the last item of an Array

name ops/sec samples
Length = 100 - Array.at 90,968,762 45485137
Length = 10_000 - Array.at 94,411,369 47249748
Length = 1_000_000 - Array.at 96,884,458 48442249
Length = 100 - Array[length - 1] 94,762,844 47401705
Length = 10_000 - Array[length - 1] 90,462,524 45231291
Length = 1_000_000 - Array[length - 1] 94,400,328 47222922
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:28:15 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Math.floor vs ~

name ops/sec samples
Math.floor (small) 94,770,660 47385341
~ (small) 93,075,995 46552820
Math.floor (long) 94,494,632 47252453
~ (long) 93,615,179 46810695
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:29:22 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Object Creation

name ops/sec samples
Object.create(null) 38,529,369 19323392
Object.create({}) 2,097,302 1048652
new Function with empty prototype 70,695,980 35352382
Empty class 73,786,638 36894004
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:30:30 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Parsing Integer

name ops/sec samples
Using parseInt(x, 10) - small number (2 len) 90,875,631 45437825
Using parseInt(x, 10) - big number (10 len) 95,367,825 47683923
Using + - small number (2 len) 95,047,928 47523976
Using + - big number (10 len) 95,426,018 47713021
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:31:22 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Possible undefined Function

name ops/sec samples
Using if to check function existence 1,192,131 602692
Using ? operator to avoid rejection 1,195,269 597950
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:31:57 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Private Property

name ops/sec samples
Raw usage private field 96,583,646 48291839
Raw usage underscore usage 96,990,724 48495375
Manipulating private properties using # 97,896,464 48948246
Manipulating private properties using underscore(_) 97,813,650 48919573
Manipulating private properties using Symbol 95,544,992 47779754
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:32:51 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Property access after shape transition

name ops/sec samples
Adding property after object creation - small object 7,070,032 3535202
Adding property in the object creation - small object 7,425,788 3716099
Adding property after the function creation - small class 273,415 136708
Adding property in the function creation - small class 291,115 145731
Adding property after the class creation - small class 283,574 141788
Adding property in the class creation - small class 272,353 143656
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:33:42 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Property Getter Access

name ops/sec samples
Getter (class) 92,276,077 46140801
Getter 52,689,064 26368424
Method 95,522,838 47761445
DefineProperty (getter) 94,489,536 47252783
DefineProperty (getter & enumerable=false) 52,925,950 26662803
DefineProperty (getter & configurable=false) 92,767,527 46391465
DefineProperty (getter & enumerable=false & configurable=false) 53,292,264 26653713
DefineProperty (writable) 95,443,692 47723888
DefineProperty (writable & enumerable=false) 95,288,438 47649845
DefineProperty (writable & enumerable=false & configurable=false) 94,202,916 47116203
DefineProperties (getter) 53,901,566 26950917
DefineProperties (getter & enumerable=false) 52,986,958 26533968
DefineProperties (getter & enumerable=false & configurable=false) 53,763,457 26881735
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:35:11 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Property Setter Access

name ops/sec samples
Setter (class) 91,320,628 45660325
Setter 10,798,636 5399585
Method 86,327,242 43184996
DefineProperty (setter) 89,943,143 44982925
DefineProperty (setter & enumerable=false) 10,728,532 5364764
DefineProperty (setter & configurable=false) 10,759,853 5383006
DefineProperty (setter & enumerable=false & configurable=false) 10,819,581 5409794
DefineProperty (writable) 89,519,736 44760602
DefineProperty (writable & enumerable=false) 89,626,689 44813357
DefineProperty (writable & enumerable=false & configurable=false) 90,245,088 45128543
DefineProperties (setter) 91,298,244 45649148
DefineProperties (setter & enumerable=false) 10,583,049 5297270
DefineProperties (setter & enumerable=false & configurable=false) 10,463,466 5231739
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:36:55 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

replace vs replaceAll comparison

name ops/sec samples
Using replace(//g) 4,003,827 2001915
Using replaceAll() 3,097,451 1548892
Using replaceAll(//g) 3,439,050 1719848
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:37:31 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Shallow Copy

name ops/sec samples
{ ...object } 24,834,632 12417573
{ ...object, proto: null } 2,413,322 1206662
{ ...object, newProp: true } 22,624,040 11312639
structuredClone 294,291 147146
JSON.parse + JSON.stringify 300,799 150415
loop + object.keys starting with {} 1,730,678 865523
loop + object.keys starting with { proto: null } 923,920 462009
loop + object.keys starting with { randomProp: true } 682,023 341013
object.keys + reduce(FN, {}) 1,762,149 881217
object.keys + reduce(FN, { proto: null }) 945,012 472611
object.keys + reduce(FN, { newProp: true }) 699,846 349943
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:38:17 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Sorting Map

name ops/sec samples
Sort using default 326,849 163538
Sort using first char 1,347,255 673650
Sort using localeCompare 1,245,833 623058
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:39:40 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Object.assign VS spread operator

name ops/sec samples
{...bigObject} - Total keys: 1000 3,161 1582
{...smallObject} - Total keys: 2 40,418,195 20209569
Object.assign({}, bigObject, anotherBigObject) - Total keys: 1000 - creating new object 1,133 567
Object.assign(bigObject, anotherBigObject) - mutating bigObject 6,621 3311
{ ...bigObject, ...anotherBigObject } 1,542 772
Object.assign({}, smallObject, anotherSmallObject) - creating new object 12,167,913 6084175
Object.assign(smallObject, anotherSmallObject) - mutating smallObject 25,953,228 12976617
{ ...smallObject, ...anotherSmallObject } 19,763,967 9884418
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:40:33 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Stream.Readable

name ops/sec samples
streams.Readable reading 1e3 * "some data" 1,957 980
streams.web.Readable reading 1e3 * "some data" 1,804 903
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:41:29 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Stream.Writable

name ops/sec samples
streams.Writable writing 1e3 * "some data" 10,300 5152
streams.web.WritableStream writing 1e3 * "some data" 1,662 851
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:42:12 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

String concat

name ops/sec samples
Using + sign 94,561,364 47341704
Using backtick (`) 93,694,086 46848041
Using array.join 9,915,417 4957711
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:43:11 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

endsWith comparison

name ops/sec samples
(short string) (true) String#endsWith 82,426,730 41213371
(short string) (true) String#slice and strict comparison 51,274,369 25640247
(long string) (true) String#endsWith 59,051,367 29529159
(long string) (true) String#slice and strict comparison 46,624,826 23314676
(short string) (false) String#endsWith 90,717,444 45394488
(short string) (false) String#slice and strict comparison 52,315,908 26162544
(long string) (false) String#endsWith 82,375,637 41188149
(long string) (false) String#slice and strict comparison 46,533,397 23271216
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:44:17 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

String searching

name ops/sec samples
Using includes 16,235,237 8124086
Using indexof 16,147,159 8074161
Using RegExp.test 12,660,113 6331275
Using RegExp.text with cached regex pattern 13,446,477 6723256
Using new RegExp.test 4,667,399 2333787
Using new RegExp.test with cached regex pattern 5,188,429 2594216
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:45:26 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

startsWith comparison

name ops/sec samples
(short string) (true) String#startsWith 85,179,165 42645179
(short string) (true) String#slice and strict comparison 56,090,167 28053544
(long string) (true) String#startsWith 67,616,289 33809406
(long string) (true) String#slice and strict comparison 51,161,024 25584515
(short string) (false) String#startsWith 91,676,182 45863360
(short string) (false) String#slice and strict comparison 56,262,449 28132194
(long string) (false) String#startsWith 87,288,003 43644810
(long string) (false) String#slice and strict comparison 49,691,456 24845856
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:46:55 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Super vs This

name ops/sec samples
Using super 88,522,120 44299181
Using this 98,354,010 49177321
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:47:39 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0

Getting unix time

name ops/sec samples
new Date().getTime() 12,619,955 6310921
Date.now() 20,135,618 10067810
Environment
  • Machine: linux x64 | 4 vCPUs | 7.6GB Mem
  • Run: Tue Aug 05 2025 14:48:50 GMT+0000 (Coordinated Universal Time)
  • Node: v24.4.0