Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
TextDecoder vs String.fromCharCode/escape/decodeURIComponent
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
decodeURIComponent/apply
1964175.6 Ops/sec
decodeURIComponent/spread
764633.4 Ops/sec
TextDecoder
7055051.5 Ops/sec
Script Preparation code:
data = new Uint8Array([ 208, 158, 208, 177, 208, 188, 208, 176, 208, 189, 209, 131, 209, 130, 209, 139, 208, 185, 32, 47, 32, 84, 104, 101, 32, 66, 101, 103, 117, 105, 108, 101, 100, 32, 40, 49, 57, 55, 49, 41, 32, 66, 68, 82, 105, 112 ]); utf8decoder = new TextDecoder('utf-8', { fatal: true })
Tests:
decodeURIComponent/apply
const result = decodeURIComponent(escape(String.fromCharCode.apply(0, data)));
decodeURIComponent/spread
const result = decodeURIComponent(escape(String.fromCharCode(...data)));
TextDecoder
const result = utf8decoder.decode(data)