Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Initialize Vec2 with int vs float
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Browser:
Chrome 130
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Vec2_int
1804.1 Ops/sec
Vec2_float
1825.8 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Tests:
Vec2_int
class Vec2_int { x = 0; y = 0; randomize() { this.x = Math.random(); this.y = Math.random(); } length2() { return this.x * this.x + this.y * this.y; } length() { return Math.sqrt(this.length2()); } } let num = 10000 let sum = 0 for (let i=0; i<num; i++) { let v = new Vec2_int(); v.randomize(); sum += v.length(); } sum /= num; console.log(sum);
Vec2_float
class Vec2_float { x = 0.5; y = 0.5; randomize() { this.x = Math.random(); this.y = Math.random(); } length2() { return this.x * this.x + this.y * this.y; } length() { return Math.sqrt(this.length2()); } } let num = 10000 let sum = 0 for (let i=0; i<num; i++) { let v = new Vec2_float(); v.randomize(); sum += v.length(); } sum /= num; console.log(sum);