Closed xaroth8088 closed 6 years ago
Interesting probably indicates something in the inliner in v8 was off. I've ran the benchmark on my phone now and get the expected result, they equivalent. Do you still get the 10% difference with a modern chrome mobile?
Oh, funny. When I tested, it was on Chrome 66, and the difference was consistent. Chrome 67 rolled out between then and now, and now there's no difference.
Closing this PR.
On desktop browsers, there's no practical difference between the various ways to truncate a float to an int. However, on Android Chrome, Math.floor() is significantly (~18%) slower than using a bitshift operation. jsperf to test for yourself
Browser profiling in Chrome pointed to this being the most expensive operation while generating the noise. In my particular application, this change dropped the total 3D noise rendering time by ~50%.