Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
lumiere fp vs raw
(version: 1)
Comparing performance of:
bench-fp vs bench-raw
Created:
8 months ago
by:
Guest
Jump to the latest result
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)) }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
bench-fp
bench-raw
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
8 months ago
)
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/OS:
Chrome 127 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
bench-fp
0.3 Ops/sec
bench-raw
5.5 Ops/sec
Related benchmarks:
Dataview vs Custom - Read uint8
Structification
Buffer Filling
Buffer Filling 2
Buffer Access
Buffer Access 2 - const arrays
Uint32Array copy vs set
uint32 DataView vs Direct Calculate
Bytes to BigInt64
Comments
Confirm delete:
Do you really want to delete benchmark?