Latest Benchmarks

Browse the latest JavaScript performance benchmarks created by the community.

replace vs substring vs slice from beginning (+ brackets, substr, compiled vs inline regex and replace from var)

Test the performance of replace() vs substring() vs slice() when replacing a char at the beginning of a (in this case uri query-)string that may or may not be there. Added the combined brackets[ ] + substr() method, since it's always the first char we wan't to pop off. Inspired by https://jsperf.com/replace-or-substr. Note: could not get 'let' and 'const' to work. Well, too bad...

JSON.stringify vs structuredClone more

JSON.stringify vs structuredClone

for-in vs object.keys in loop

No description provided

String concatenation vs array join v6

No description provided

6546878965987987987984981651324684654984658489465798654984659856416514698584

while vs lastIndexOf

5165168465468465216546516546513657354365435218561549845

while vs lastIndexOf

dataset vs getAttribute() vs jQuery.data() vs jQuery.attr()

No description provided

Array of Objects to Object with keys Object.fromEntries v Object.assign

Convert an array of objects to an object whose keys are derrived from a property on each object in array.

eval vs new Function (including parse)

No description provided

boolean vs math length

No description provided

OffsetScreenCanvas.measureText VS. Canvas.measureText

No description provided

parseFloat for me

No description provided

window.getComputedStyle vs. getBoundingClientRect vs clientHeight

No description provided

calculate time once vs multiple comparisons

No description provided

Reduce vs. Find

No description provided

Object Deep Copy (with structuredClone)

Produce a deep copy of a Javascript object where nested objects are not simply references to the originals.

String compares (sensitive & insensitive & undefined)

No description provided

String compares (sensitive & insensitive)

No description provided

JavaScript spread operator vs Object.assign performance ( nested objects ) into empty object

No description provided

var let const var let const

No description provided

Regex removing whitespace vs trim 3

testing removing end whitespace vs trim

Regex removing whitespace vs trim 2

testing removing end whitespace vs trim

try vs if // no error

No description provided

try vs if

No description provided

var vs let vs const v2

No description provided