Skip to content

Commit b227def

Browse files
gspowleyShelnutt2
andauthored
Open vcf_header and data arrays in parallel (#696)
Co-authored-by: Seth Shelnutt <[email protected]>
1 parent 53f5c78 commit b227def

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

libtiledbvcf/src/dataset/tiledbvcfdataset.cc

+11-2
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,17 @@ void TileDBVCFDataset::open(
512512
if (prefetch_data_array_fragment_info)
513513
preload_data_array_fragment_info();
514514

515-
data_array_ = open_data_array(TILEDB_READ);
516-
vcf_header_array_ = open_vcf_array(TILEDB_READ);
515+
// Open the data and vcf_header arrays in parallel
516+
auto data_array_async = std::async(std::launch::async, [this]() {
517+
data_array_ = open_data_array(TILEDB_READ);
518+
});
519+
auto vcf_header_array_async = std::async(std::launch::async, [this]() {
520+
vcf_header_array_ = open_vcf_array(TILEDB_READ);
521+
});
522+
523+
// Block until the arrays are open, log and rethrow any exceptions
524+
TRY_CATCH_THROW(vcf_header_array_async.get());
525+
TRY_CATCH_THROW(data_array_async.get());
517526
read_metadata();
518527

519528
// We support V2, V3 and V4 (current) formats.

libtiledbvcf/src/enums/attr_datatype.h

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#ifndef TILEDB_VCF_ATTR_DATATYPE_H
3131
#define TILEDB_VCF_ATTR_DATATYPE_H
3232

33+
#include <cstdint>
3334
#include <stdexcept>
3435
#include <string>
3536

0 commit comments

Comments
 (0)