Skip to content

Conversation

@pcanal
Copy link
Member

@pcanal pcanal commented Nov 20, 2024

This add TStreamerInfo actions for the case of base class, nested objects, externally assignment streamer and array thereof (kBase, kAny, kStreamer, kStreamLoop) for both scalar and collection cases. It also expands the scope of the writing actions to cover the collections cases and the new cases (kBase, kAny, kStreamer, kStreamLoop)

Companion PR of root-project/roottest#1224

When executing the streaming on an object, the execution of the case covered by the case kBase, kAny, kStreamer, kStreamLoop was migrated from using the legacy code within the source file TStreamerInfoReadBuffer.cxx and TStreamerInfoWriteBuffer.cxx which is based on a pair of 'giant' switch statement to the newer framework based on the composition of TStreamerInfoActions (and the corresponding collection: TActionSequence). The change from switch statement to a set of function pointers allows to improve performance by executing for each data members only the code strictly necessary.

In its previous implementation (which is still used in a few rare cases involved backward compatibility), the case kBase (for both reading and writing) was forcing the use of the switch statement for all the data members of the base classes. This prevented the use of the new convert-on-write actions (with no existing corresponding implementation in the write switch statement) that are necessary for supporting the Enums with non default size.

This enables the StreamerInfoActions to enable the shortcuts that
are possible in that case.
The version recorded 'here' is the version of the TStreamerInfo class not the user class
Even without schema evolution, the representation of a collection of enums
on file is a `vector<int>` so `TStreamerElement::fType` and `TStreamerElement::fClassObject`
should point to `vector<int>` while `TStreamerElement::fNewType` and
`TStreamerElement::fNewClass` should point to the current in memory representaition
`actualCollectionType< actualEnum >` that will know/remember what is the actual enum
in memory representation.
Combine the code with the one use for the text actions
Combine the code with the one use for the text actions
To use be for case where the read and write implementation differs only slightly
To be used for function template that can be used for more than one actual looper (usually in
conjunction with the LoopOverCollection template
Allow to share code with the collection loopers.
@pcanal pcanal self-assigned this Nov 20, 2024
@github-actions
Copy link

github-actions bot commented Nov 20, 2024

Test Results

    18 files      18 suites   3d 21h 3m 41s ⏱️
 2 687 tests  2 686 ✅ 0 💤 1 ❌
46 530 runs  46 529 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 17097bc.

♻️ This comment has been updated with latest results.

@pcanal pcanal force-pushed the io-actions-expansion branch from ef312d6 to c9d3c07 Compare November 21, 2024 03:34
@pcanal pcanal marked this pull request as ready for review November 22, 2024 04:04
@pcanal pcanal requested a review from dpiparo as a code owner November 22, 2024 04:04
@pcanal pcanal requested a review from jblomer November 22, 2024 04:04
@pcanal pcanal closed this Nov 26, 2024
@pcanal pcanal reopened this Nov 26, 2024
Copy link
Member

@dpiparo dpiparo left a comment

Choose a reason for hiding this comment

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

Thanks for this major improvement. I added some comments for the review. In general I believe it could be very useful to take this opportunity, perhaps to the documentation of TStreamerInfo, to add a 1 page explanation of what this major overhaul does, also explaining simply, without code and only in English, what the pre-existing code was doing.

@pcanal pcanal changed the title Expansion of the TStreamerInfo actions rules Expansion of the TStreamerInfo actions. Nov 26, 2024
@pcanal
Copy link
Member Author

pcanal commented Nov 26, 2024

to add a 1 page explanation of what this major overhaul does, also explaining simply, without code and only in English, what the pre-existing code was doing.

When executing the streaming on an object, the execution of the case covered by the case kBase, kAny, kStreamer, kStreamLoop was migrated from using the legacy code within the source file TStreamerInfoReadBuffer.cxx and TStreamerInfoWriteBuffer.cxx which is based on a pair of 'giant' switch statement to the newer framework based on the composition of TStreamerInfoActions (and the corresponding collection: TActionSequence). The change from switch statement to a set of function pointers allows to improve performance by executing for each data members only the code strictly necessary.

In its previous implementation (which is still used in a few rare cases involved backward compatibility), the case kBase (for both reading and writing) was forcing the use of the switch statement for all the data members of the base classes. This prevented the use of the new convert-on-write actions (with no existing corresponding implementation in the write switch statement) that are necessary for supporting the Enums with non default size.

@pcanal pcanal closed this Nov 27, 2024
@pcanal pcanal reopened this Nov 27, 2024
@pcanal pcanal merged commit 8b3ce21 into root-project:master Dec 3, 2024
56 of 61 checks passed
@pcanal pcanal deleted the io-actions-expansion branch December 3, 2024 22:20
@pcanal pcanal restored the io-actions-expansion branch December 4, 2024 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants