composewell / streamly

High performance, concurrent functional programming abstractions
https://streamly.composewell.com
Other
856 stars 64 forks source link

Use 2 bytes to encode the header length in compatible record serialization #2593

Open adithyaov opened 11 months ago

adithyaov commented 11 months ago

We currently use 4 bytes to encode the header length in compatible record serialization. Using 2 bytes (Word16) over 4 bytes (Word32) causes about 5% regression in the peek benchmark. Check why the regression happens.

Is Word32 more efficient than Word16? Possibly as we need to mask more bits in Word16.

With that in mind, is Word64 the most efficient? No, It is not. (Checked)

See https://github.com/composewell/streamly/pull/2584 Reverting the last commit introduces 5% regression in the compatible record benchmark.