Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RF] Remove safeDeleteList functionality of RooAbsCollection #9685

Merged
merged 2 commits into from
Jan 26, 2022

Conversation

gartrog
Copy link
Contributor

@gartrog gartrog commented Jan 25, 2022

This is presumbaly a bit controversial.

safeDeleteList remove elements in order in a RooAbsCollection,
starting with the ones that only have clients and no servers.

This is a slow process, and takes 25% of CPU time on large workspace
manipulation workflows, as it takes place at each workspace::import
call. It can also lead to slow ~RooWorkspace.

The point is, I don't think this logic is needed at all.
~RooAbsArg takes care of properly breaking all the client-server links,
both uplinks and downlinks, for every object. I couldn't find a logical
case where a crash would occur if the safeDeleteList logic were to be
removed.

All RooFit tests pass after this patch. No problem for my heavy
workspace manipulation worflows either.

This is presumbaly a bit controversial.

safeDeleteList remove elements in order in a RooAbsCollection,
starting with the ones that only have clients and no servers.

This is a slow process, and takes 25% of CPU time on large workspace
manipulation workflows, as it takes place at each workspace::import
call. It can also lead to slow ~RooWorkspace.

The point is, I don't think this logic is needed at all.
~RooAbsArg takes care of properly breaking all the client-server links,
both uplinks and downlinks, for every object. I couldn't find a logical
case where a crash would occur if the safeDeleteList logic were to be
removed.

All RooFit tests pass after this patch. No problem for my heavy
workspace manipulation worflows either.
@phsft-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@hageboeck
Copy link
Member

If it works, it's all-the-more good to have complicated destructor magic out of the way.

@hageboeck
Copy link
Member

@phsft-bot build

@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

@hageboeck
Copy link
Member

The point is, I don't think this logic is needed at all. ~RooAbsArg takes care of properly breaking all the client-server links, both uplinks and downlinks, for every object. I couldn't find a logical case where a crash would occur if the safeDeleteList logic were to be removed.

All RooFit tests pass after this patch. No problem for my heavy workspace manipulation worflows either.

By now, I think that the breaking of the links came after this destructor magic. You might be right that this is not needed, any more. I suggest to put it in master and see if the address sanitizer build blows up.

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-performance-centos8-multicore/default.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Failing tests:

@guitargeek
Copy link
Contributor

guitargeek commented Jan 25, 2022

Hi @gartrog, thanks for this! I agree that the order doesn't matter, as the RooAbsArg destructor is taking care that there are no dangling pointers in the client and server list.

If the ASAN build doesn't complain after merging this, the PR should also be backported to 6.26. It would be a waste to have this nice speedup not in the release.

Copy link
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

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

Just one little request: can you please rename safeDeleteList to deleteList now? And adapt the function documentation to make sense even after the "safe" deletion is removed?

@gartrog
Copy link
Contributor Author

gartrog commented Jan 25, 2022

Should be done @guitargeek

@guitargeek
Copy link
Contributor

guitargeek commented Jan 26, 2022

Thanks a lot!

@guitargeek
Copy link
Contributor

@phsft-bot build

@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

Copy link
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

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

LGTM, thank you very much! It's about time that this overhead gets removed.

@guitargeek guitargeek merged commit c46c6d3 into root-project:master Jan 26, 2022
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.

4 participants