Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
tinybench + TypeScript demo: typed array sum v2
Demo benchmark with test cases written in TypeScript (type annotations are stripped in the browser by sucrase before running under the tinybench engine).
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36 Edg/153.0.0.0
Browser:
Chrome 153
Operating system:
Windows
Device Platform:
Desktop
Date tested:
yesterday
Benchmark engine:
tinybench
typed for loop
839K/s
typed for-of
790K/s
View exact numbers
Test name
Executions per second
✓
typed for loop
839,107 Ops/sec
typed for-of
789,969 Ops/sec
Script Preparation code:
var data = Array.from({length: 1000}, function(_, i){ return i; });
Tests:
typed for loop
function sumFor(arr: number[]): number { let total: number = 0; for (let i: number = 0; i < arr.length; i++) { total += arr[i]; } return total; } sumFor(data);
typed for-of
function sumOf(arr: number[]): number { let total: number = 0; for (const x of arr) { total += x; } return total; } sumOf(data);