String Comparison Performance

Benchmark created on


Description

Testing different methods for string comparison in JavaScript

Setup

const str1 = "hello world";
const str2 = "hello world";
const str3 = "different string";

Test runner

Ready to run.

Testing in
TestOps/sec
=== operator
str1 === str2
ready
localeCompare
str1.localeCompare(str2) === 0
ready
== operator
str1 == str2
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.