Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
explicit int32 types vs regular js 2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.5 Safari/605.1.15
Browser:
Safari 26
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one month ago
Test name
Executions per second
regular js
20545.4 Ops/sec
modern js
14330.0 Ops/sec
explicit int32 types
14663.1 Ops/sec
explicit int32 types 2
14893.6 Ops/sec
explicit int32 types modern
14659.6 Ops/sec
Script Preparation code:
"use strict"; const arr = []; for (let i=0; i<1000; i++) { arr[i] = Array.from({length: Math.floor(Math.random() * 101)}, (function(){return 97 | 0})); arr[i].push(0); } function strlen(str) { let current = 0; while (str[current] != 0) { current = current + 1; } return current; } function strlen_modern(str) { let current = 0; while (str[current] !== 0) { current += 1; } return current; } function strlen_explicit(str) { let current = 0; while ((str[current >> 0] | 0) != 0) { current = (current + 1) | 0; } return current | 0; } function strlen_explicit_modern(str) { let current = 0; while ((str[current >> 0] | 0) !== 0) { current = (current + 1) | 0; } return current | 0; }
Tests:
regular js
"use strict"; let x = 0; for (let i=0; i<1000; i++) { x = strlen(arr[i]); }
modern js
"use strict"; let x = 0; for (let i=0; i<1000; i++) { x = strlen_modern(arr[i]); }
explicit int32 types
"use strict"; let x = 0; for (let i=0; i<1000; i++) { x = strlen_explicit(arr[i]) | 0; }
explicit int32 types 2
"use strict"; let x = 0; for (let i=0; i<1000; i = (i+1) | 0) { x = strlen_explicit(arr[i >> 0]) | 0; }
explicit int32 types modern
"use strict"; let x = 0; for (let i=0; i<1000; i = (i+1) | 0) { x = strlen_explicit_modern(arr[i >> 0]) | 0; }