Add a flexible array member to the bam1_t struct to facilitate a BAM …#393
Add a flexible array member to the bam1_t struct to facilitate a BAM …#393nathanweeks wants to merge 1 commit intosamtools:developfrom
Conversation
…sorting optimization.
|
I've done this sort of thing before, it's how "io_lib" works infact. You don't really need a separate variable as I fully support making use of reducing malloc overheads. I think we discussed sort in the office once and concluded that it could also be fixed by having one large single malloc block of memory that the data pointers are set to and using a pool-allocator (eg see htslib/cram/pooled_alloc.[ch]) for obtaining the bam1_t structs, turning it into just a handful of mallocs. I don't think anyone coded it up yet though so credit for tackling this one. |
Add a flexible array member to the bam1_t struct to allow the variable-length data to be colocated in memory with the rest of the bam1_t. This should be backwards compatible, as the addition of the flexible array member shouldn't alter sizeof(bam1_t) in this case.
This is used by the samtools sort optimization described in samtools/samtools#593