Skip to main content

Module inline_buffer

Module inline_buffer 

Source
Expand description

Inline record buffer for samtools-style memory layout.

This module provides a contiguous buffer that stores BAM records inline with pre-computed sort keys, eliminating per-record heap allocations.

Key benefits over Vec<(Key, Record)>:

  • Single large allocation instead of millions of small ones
  • Better cache locality - sequential memory access
  • Sort by index array, not by moving actual record data
  • ~24 bytes overhead per record vs ~110 bytes

Structs§

PackedCoordKey
Packed sort key for coordinate ordering.
RecordBuffer
Contiguous buffer for inline record storage.
RecordRef
Reference to a record in the buffer (used for sorting).
TemplateInlineHeader
Inline header stored before each record in the data buffer. This allows us to use a minimal ref structure while still having fast access to the full sort key.
TemplateKey
Extended key for template-coordinate sorting.
TemplateRecordBuffer
Template-coordinate record buffer with inline headers.
TemplateRecordRef
Record reference for template-coordinate sorting with cached key.

Constants§

TEMPLATE_HEADER_SIZE
Size of TemplateInlineHeader in bytes.

Functions§

extract_coordinate_key_inline
Extract coordinate sort key directly from raw BAM bytes.
parallel_radix_sort_record_refs
Parallel radix sort for RecordRef arrays.
parallel_radix_sort_template_refs
Parallel radix sort for TemplateRecordRef arrays.
radix_sort_record_refs
Radix sort for RecordRef arrays using LSD (Least Significant Digit) approach.
radix_sort_template_refs
Radix sort for TemplateRecordRef arrays using multi-field LSD approach.