Skip to content

Commit 4d27b1e

Browse files
author
Martin Foll
committed
Optimization of loading chunks by sorting BlocksInChunks first
1 parent 13eef9d commit 4d27b1e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tmva/tmva/inc/TMVA/BatchGenerator/RChunkLoader.hxx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,12 @@ public:
350350
// fill a chunk by looping over the blocks in a chunk (see RChunkConstructor)
351351
std::size_t chunkEntry = 0;
352352
std::vector<std::pair<Long_t, Long_t>> BlocksInChunk = fTraining->ChunksIntervals[chunk];
353+
354+
std::sort(BlocksInChunk.begin(), BlocksInChunk.end(),
355+
[](const std::pair<Long_t, Long_t>& a, const std::pair<Long_t, Long_t>& b) {
356+
return a.first < b.first;
357+
});
358+
353359
for (std::size_t i = 0; i < BlocksInChunk.size(); i++) {
354360

355361
// Use the block start and end entry to load into the chunk if the dataframe is not filtered
@@ -416,6 +422,12 @@ public:
416422

417423
std::size_t chunkEntry = 0;
418424
std::vector<std::pair<Long_t, Long_t>> BlocksInChunk = fValidation->ChunksIntervals[chunk];
425+
426+
std::sort(BlocksInChunk.begin(), BlocksInChunk.end(),
427+
[](const std::pair<Long_t, Long_t>& a, const std::pair<Long_t, Long_t>& b) {
428+
return a.first < b.first;
429+
});
430+
419431
for (std::size_t i = 0; i < BlocksInChunk.size(); i++) {
420432

421433
// use the block start and end entry to load into the chunk if the dataframe is not filtered

0 commit comments

Comments
 (0)