The GitHub Actions job "Scalafmt" on pekko.git/bytestring-equals-perf has 
succeeded.
Run started by GitHub user pjfanning (triggered by pjfanning).

Head commit for run:
b77a2a3e85557c932e55fb20abb9f4e01ddb850a / PJ Fanning 
<[email protected]>
perf: pack the ByteStrings fragment hint into a long

The memoised fragment lookup held its (index, start, end) triple in a
small object, allocating a fresh one every time the resolved fragment
changed. Traversing a ByteString of 1024 single-byte fragments allocated
24 bytes per read; even with 64-byte fragments it was 24 bytes per
fragment crossing.

Pack the index and start offset into a single long field instead: index
in the high 32 bits, start in the low 32. A single read still yields a
consistent pair, so a reader can never combine the index of one fragment
with the start of another, which separate int fields would allow. The end
offset is no longer stored and is recomputed as start + fragment.length,
a cheap array read on the miss path only.

Allocation on the traversal path drops to zero. Throughput is unchanged:
the two forms measure within run-to-run noise of each other, so this is
about allocation rather than speed.

Report URL: https://github.com/apache/pekko/actions/runs/32739512831

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to