Split integers

Benchmark created on


Preparation HTML

<script>
var n = 12345678;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Substring + parse
var x = n.toString()
parseInt(x.substring(0,4) * 10000)
parseInt(x.substring(4))
ready
Floor / Modulo
Math.floor(n / 10000) * 10000
n % 10000
ready

Revisions

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