Array vs String for lookup table

Benchmark created on


Preparation HTML

<script>
  var s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var a = s.split('');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
String.charAt
s.charAt(0);
s.charAt(63);
s.charAt(32);
ready
Array indexing
a[0];
a[63];
a[32];
ready
String indexing
s[0];
s[63];
s[32];
ready

Revisions

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