greatscottgadgets / packetry

A fast, intuitive USB 2.0 protocol analysis application for use with Cynthion.
BSD 3-Clause "New" or "Revised" License
123 stars 24 forks source link

Use 24-bit rather than 16-bit increments for timestamps. #170

Closed martinling closed 1 month ago

martinling commented 1 month ago

Using 16-bit deltas (2 bytes) in CompactIndex is a poor fit for nanosecond timestamp data, and causes the index to write a lot of blocks each time the delta range overflows, which also makes access inefficient. This is most noticeable when saving a capture, which requires reading all timestamps.

Using 24-bit deltas (3 bytes) works a lot better. I also tried 32-bit (4 bytes) but didn't see much difference in performance.

Fixes #169.

martinling commented 1 month ago

Might be worth doing a 2.0.1 release for this.