Skip to content

Commit 20734bd

Browse files
committed
Updated Reader::report_cell() to cache headers when exporting records
This significantly reduces run-time by reducing time spent parsing header strings and (de)allocating header objects.
1 parent de62b23 commit 20734bd

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

libtiledbvcf/src/read/reader.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,12 +1686,13 @@ bool Reader::report_cell(
16861686
sample = SampleAndId{std::string(sample_name, size)};
16871687
}
16881688

1689-
SafeBCFHdr hdr(nullptr, bcf_hdr_destroy);
1689+
bcf_hdr_t* hdr = nullptr;
16901690
if (read_state_.need_headers) {
1691-
hdr = read_state_.current_hdrs.get_sample_header(sample.sample_name);
1691+
hdr = read_state_.current_hdrs.get_sample_header_shared(sample.sample_name)
1692+
.get();
16921693
}
16931694
if (!exporter_->export_record(
1694-
sample, hdr.get(), region, contig_offset, results, cell_idx))
1695+
sample, hdr, region, contig_offset, results, cell_idx))
16951696
return false;
16961697

16971698
// If no overflow, increment num records count.

0 commit comments

Comments
 (0)