Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Int vs string split
(version: 3)
Comparing performance of:
Integer vs CSV
Created:
10 months ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
// Initialization const N = 10000; const numbers = new Int32Array(N); for (let i = 0; i < N; i++) { numbers[i] = Math.floor(Math.random() * 1000000); } // Pack into ArrayBuffer for getInt32 const buf = new ArrayBuffer(N * 4); const view = new DataView(buf); for (let i = 0; i < N; i++) { view.setInt32(i * 4, numbers[i], true); } // Pack into comma-separated string for split const csv = numbers.join(",");
Tests:
Integer
let sum = new Array(N); for (let i = 0; i < N; i += 2) { sum[i]=view.getInt32((i) * 4, true); sum[i+1]=view.getInt32((i+1) * 4, true); }
CSV
let sum = 0; const parts = csv.split(",");
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Integer
CSV
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
10 months ago
)
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Mobile/15E148 Safari/604.1
Browser/OS:
Mobile Safari 18 on iOS 18.6
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Integer
102923.7 Ops/sec
CSV
10925.4 Ops/sec
Related benchmarks:
Dataview vs Custom - Read uint32
copy ArrayBuffer: DataView vs Uint8Array.set vs Float64Array.set vs by bytes v2
ArrayBuffer Copy Benchmark (2)
DataView vs Uint32Array
copy copy copy copy copy
DataView vs Uint8Array by bytes vs Uint8Array set Uint8Array
Float32Array vs DataView 2022
read write ArrayBuffer: DataView vs Float64Array.set v2
DataView vs Uint8Array by bytes write + read
Comments
Confirm delete:
Do you really want to delete benchmark?