Inefficient de-registering of objects when plotting and using TPad
Maintainer thường phản hồi trong vòng 1 ngày
@hageboeck đang làm issue này rồi.
Từ ngày 2/12/2025.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Explain what you would like to see improved and how.
Hello,
I did some profiling of the code performance when producing a lot of plots ~ 100k or so (note this is not that unusual in a real analysis).
The relevant code looks like this:
TCanvas c("c","c",800,600);
TPad pad0("pad0","pad0",0,0.30,1,1,0,0,0);
std::unique_ptr<TH1> nominal(...);
nominal->SetDirectory(nullptr);
nominal->Draw()
The code works well but the profiling shows that a lot of time is spent in the deleting/de-registering the objects, see this screenshot from VTune (a simplifed version of the real run)
After a lot of help from @hageboeck, one needs to use the following code to improve the situation:
TObject *obj;
TIter next(pad0.GetListOfPrimitives());
while ((obj = next())) {
if (auto hist = dynamic_cast<TH1*>(obj)) {
hist->SetBit(kMustCleanup, false);
}
if (auto tl = dynamic_cast<TLatex*>(obj)) {
tl->SetBit(kMustCleanup, false);
}
if (auto tli = dynamic_cast<TLine*>(obj)) {
tli->SetBit(kMustCleanup, false);
}
}
As you can see, this is not the most obvious code and it does not even solve the problem completely as there is still bottlenck coming from TPave destructor from TLegend. Using the same technique as above causes segfault.
There is probably no easy solution to this, I just wanted to open this issue so that these inefficiencies are not forgotten for the future updates.
ROOT version
ROOT Version: 6.39.01
Built for linuxx8664gcc on Nov 26 2025, 08:33:23
From heads/master@v6-39-01-296-gfac9b1c307b
Installation method
built from source
Operating system
Ubuntu 25.10
Additional context
No response
- Ngôn ngữ chính
- C++
- Star
- 3.3k
- Fork
- 1.6k
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 188
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của root-project/root
-
thisroot.sh: wrong ROOTSYS in zsh when the shell's command line has a newlineCó thể đã có người làm @dpiparo đã nhận 4 ngày trước. Đang mởbug in:Build System
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
root-project/root#23746 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[tmva][sofie] Inputs of unsupported type (e.g. float16) give code that does not compile instead of an errorCó thể đã có người làm @lmoneta đã nhận 14 ngày trước. Đang mởAI-Assisted bug in:SOFIE
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
root-project/root#23655 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[RDataFrame] Code that transforms `#var` alias to `R_rdf_sizeof_var` does not respect string literalsCó thể đã có người làm @vepadulano đã nhận 1 ngày trước. Đang mởbug in:RDataFrame
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 71/100
root-project/root#23790 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TDataMember::GetOffset interfers to TDataMember::GetOffsetCintCó thể đã có người làm @pcanal đã nhận 1 ngày trước. Đang mởbug in:Core Libraries
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
root-project/root#23777 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`TChain::GetEntries` internal caching ineffective?Có thể đã có người làm @pcanal đã nhận 7 ngày trước. Đang mởimprovement in:TTree
root-project/root#23738 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của root-project/root
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
foxglove/mcap#1907 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
telegramdesktop/tdesktop#31505 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ll-builder shell completions omit existing lockfile commands and --lockedCó thể đã có người làm @project-nju-learner đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
OpenAtom-Linyaps/linyaps#2291 ·
Maintainer thường phản hồi trong vòng 1 ngày