Conversion to Integer

Benchmark created by alpicola on


Preparation HTML

<script>
  var n = Math.random() * 1000;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
bitwise NOT
~~n;
ready
bitwise OR
n | 0;
ready
Math.floor
Math.floor(n);
ready
Math.ceil
Math.ceil(n);
ready
Math.round
Math.round(n);
ready
parseInt
parseInt(n, 10);
ready

Revisions

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

  • Revision 1: published by alpicola on
  • Revision 2: published by Andrew J. Baker on