Hasty Briefsbeta

Notes on Sorted Data

8 days ago
  • #data-structures
  • #serialization
  • #sorting
  • Challenges in storing and comparing sorted data using byte strings.
  • Fixed-width integers can waste space and have endianness issues.
  • Variable-length integers (varints) can break ordering when compared byte-by-byte.
  • Length-prefixing integers preserves ordering but uses an extra byte.
  • Optimizing length-prefix with 4 bits to save space, with limitations.
  • Handling signed integers by remapping to unsigned for correct ordering.
  • Floating point numbers require special handling due to their binary representation.
  • Length-prefixing strings can lead to incorrect ordering comparisons.
  • Using null terminators for strings and composite data to preserve ordering.
  • Composite data (tuples, structs) can be separated by null terminators for correct ordering.