Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Chrome 133
Windows
Desktop
one year ago
Uint8Array.from + charCodeAt
13/s
Uint8Array.from + codePointAt
12/s
for-loop + codePointAt
10/s
for-loop + Uint8Array.from + codePointAt (big chunk)
9/s
for-loop + Uint8Array.from + charCodeAt (big chunk)
9/s
for-loop + Uint8Array.from + charCodeAt (small chunk)
9/s
for-loop + Uint8Array.from + codePointAt (small chunk)
9/s
for-loop + charCodeAt
9/s
View exact numbers
Test name Executions per second
Uint8Array.from + charCodeAt 13 Ops/sec
Uint8Array.from + codePointAt 12 Ops/sec
for-loop + codePointAt 10 Ops/sec
for-loop + Uint8Array.from + codePointAt (big chunk) 9 Ops/sec
for-loop + Uint8Array.from + charCodeAt (big chunk) 9 Ops/sec
for-loop + Uint8Array.from + charCodeAt (small chunk) 9 Ops/sec
for-loop + Uint8Array.from + codePointAt (small chunk) 9 Ops/sec
for-loop + charCodeAt 9 Ops/sec
Script Preparation code:
Tests: