Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
lumiere fp vs raw
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/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
8 months ago
Test name
Executions per second
bench-fp
0.3 Ops/sec
bench-raw
5.5 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const recycleConcat = (left = new Uint8Array(), right = new Uint8Array()) => { const totalByteLength = left.byteLength + right.byteLength const newView = new Uint8Array( left.buffer.byteLength >= totalByteLength ? left.buffer : new ArrayBuffer(totalByteLength), 0, totalByteLength, ) console.log('left', left, 'right', right, 'lbl', left.byteLength) newView.set(left) newView.set(right, left.byteLength) return newView } const fpRecycleConcat = right => left => recycleConcat(left, right) const asUint8 = ta => new Uint8Array(ta.buffer) const pipe2 = (f, g) => x => g(f(x)) const pipe = (...fns) => fns.reduce(pipe2) const TRANSMIT = 2 const createHeader = (id, type) => Uint8Array.of( ...asUint8(new Uint16Array([id])), type, ) const createTransmitMessageFp = (id, message) => { const header = createHeader(id, TRANSMIT) const messageLength = asUint8(Uint32Array.of(message.length)) const transmitMessage = new Uint8Array( header.byteLength + messageLength.length + message.length, ) return pipe( fpRecycleConcat(header), fpRecycleConcat(messageLength), fpRecycleConcat(message), )(transmitMessage.subarray(0, 0)) } const createTransmitMessageRaw = (id, message) => Uint8Array.of( ...createHeader(id, TRANSMIT), ...asUint8(Uint32Array.of(message.length * (message.byteLength || 1))), ...asUint8(message) )
Tests:
bench-fp
for (let i = 0; i < 100000; i++) { createTransmitMessageFp(1, Uint8Array.of(i)) }
bench-raw
for (let i = 0; i < 100000; i++) { createTransmitMessageRaw(1, Uint8Array.of(i)) }