tofixed vs round

Benchmark created on


Description

parseFloat((cursor.x / window.innerWidth).toFixed(2)),

Setup

const cursorX = 93;

const windowInnerWidth = 1080

Test runner

Ready to run.

Testing in
TestOps/sec
toFixed
parseFloat((cursorX / windowInnerWidth).toFixed(2))
ready
round
Math.round(cursorX / windowInnerWidth * 100) / 100
ready

Revisions

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