Skip to content

[ntuple] outline several definitions from RFieldBase - #16510

Merged
silverweed merged 1 commit into
root-project:masterfrom
silverweed:ntuple_rfieldbase_outline
Sep 27, 2024
Merged

silverweed merged 1 commit into
root-project:masterfrom
silverweed:ntuple_rfieldbase_outline

Conversation

@silverweed

Copy link
Copy Markdown
Contributor

This Pull request:

moves various definitions outside of RFieldBase for improved readability

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

@jblomer jblomer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle fine, but I think at least for the classes, I'd prefer to move the docstring as well to where the actual code is.

@github-actions

github-actions Bot commented Sep 23, 2024 •

Copy link
Copy Markdown

Test Results

    14 files      14 suites   3d 13h 5m 58s ⏱️
 2 697 tests  2 697 ✅ 0 💤 0 ❌
35 511 runs  35 511 ✅ 0 💤 0 ❌

Results for commit bd0ea62.

♻️ This comment has been updated with latest results.

Comment thread tree/ntuple/v7/inc/ROOT/RFieldBase.hxx Outdated
Comment on lines +510 to +373
std::size_t Append(const void *from)
{
if (~fTraits & kTraitMappable)
return AppendImpl(from);

fPrincipalColumn->Append(from);
return fPrincipalColumn->GetElement()->GetPackedSize();
}
std::size_t Append(const void *from);

/// Populate a single value with data from the field. The memory location pointed to by to needs to be of the
/// fitting type. The fast path is conditioned by the field qualifying as simple, i.e. maps as-is
/// to a single column and has no read callback.
void Read(NTupleSize_t globalIndex, void *to)
{
if (fIsSimple)
return (void)fPrincipalColumn->Read(globalIndex, to);

if (fTraits & kTraitMappable)
fPrincipalColumn->Read(globalIndex, to);
else
ReadGlobalImpl(globalIndex, to);
if (R__unlikely(!fReadCallbacks.empty()))
InvokeReadCallbacks(to);
}

void Read(RClusterIndex clusterIndex, void *to)
{
if (fIsSimple)
return (void)fPrincipalColumn->Read(clusterIndex, to);

if (fTraits & kTraitMappable)
fPrincipalColumn->Read(clusterIndex, to);
else
ReadInClusterImpl(clusterIndex, to);
if (R__unlikely(!fReadCallbacks.empty()))
InvokeReadCallbacks(to);
}
void Read(NTupleSize_t globalIndex, void *to);
void Read(RClusterIndex clusterIndex, void *to);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outlining Append and Read does not allow the compiler to inline them anymore. For simple fields, this inlining allows to directly call into the (principal) RColumn. I'm not sure if this is important, but it's also not clear to me why these functions have to be outlined? They don't seem to use any of the outlined classes / structs...

@silverweed silverweed Sep 24, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason other than "they take up space". If it's important for them to be inlined for performance reasons then I'll just put them back there

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Yes, these two methods should remain inline-able.

@silverweed
silverweed force-pushed the ntuple_rfieldbase_outline branch from 9fbc0e9 to bd0ea62 Compare September 24, 2024 06:45
@silverweed
silverweed merged commit d52b400 into root-project:master Sep 27, 2024
@silverweed
silverweed deleted the ntuple_rfieldbase_outline branch September 27, 2024 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants