Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
explicit int32 types vs regular js
(version: 1)
Comparing performance of:
regular js vs modern js vs explicit int32 types vs explicit int32 types 2 vs explicit int32 types modern
Created:
one month ago
by:
Guest
Jump to the latest result
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(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; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
regular js
modern js
explicit int32 types
explicit int32 types 2
explicit int32 types modern
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?