Skip to content

Commit

Permalink
[ntuple] use vector reads for simple types in RArrayField
Browse files Browse the repository at this point in the history
  • Loading branch information
silverweed committed Jan 7, 2025
1 parent 710b2dd commit 9742ba5
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions tree/ntuple/v7/src/RFieldSequenceContainer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,28 @@ std::size_t ROOT::Experimental::RArrayField::AppendImpl(const void *from)

void ROOT::Experimental::RArrayField::ReadGlobalImpl(NTupleSize_t globalIndex, void *to)
{
auto arrayPtr = static_cast<unsigned char *>(to);
for (unsigned i = 0; i < fArrayLength; ++i) {
CallReadOn(*fSubFields[0], globalIndex * fArrayLength + i, arrayPtr + (i * fItemSize));
if (fSubFields[0]->IsSimple()) {
GetPrincipalColumnOf(*fSubFields[0])->ReadV(globalIndex * fArrayLength, fArrayLength, to);
} else {
auto arrayPtr = static_cast<unsigned char *>(to);
for (unsigned i = 0; i < fArrayLength; ++i) {
CallReadOn(*fSubFields[0], globalIndex * fArrayLength + i, arrayPtr + (i * fItemSize));
}
}
}

void ROOT::Experimental::RArrayField::ReadInClusterImpl(RClusterIndex clusterIndex, void *to)
{
auto arrayPtr = static_cast<unsigned char *>(to);
for (unsigned i = 0; i < fArrayLength; ++i) {
CallReadOn(*fSubFields[0], RClusterIndex(clusterIndex.GetClusterId(), clusterIndex.GetIndex() * fArrayLength + i),
arrayPtr + (i * fItemSize));
if (fSubFields[0]->IsSimple()) {
GetPrincipalColumnOf(*fSubFields[0])
->ReadV(RClusterIndex(clusterIndex.GetClusterId(), clusterIndex.GetIndex() * fArrayLength), fArrayLength, to);
} else {
auto arrayPtr = static_cast<unsigned char *>(to);
for (unsigned i = 0; i < fArrayLength; ++i) {
CallReadOn(*fSubFields[0],
RClusterIndex(clusterIndex.GetClusterId(), clusterIndex.GetIndex() * fArrayLength + i),
arrayPtr + (i * fItemSize));
}
}
}

Expand Down

0 comments on commit 9742ba5

Please sign in to comment.