Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion clingwrapper/src/clingwrapper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,10 @@ bool Cppyy::AppendTypesSlow(const std::string& name,

for (const std::string& candidate : candidates) {
std::string var = "__Cppyy_s" + std::to_string(struct_count++);
if (!Cpp::Declare(("__Cppyy_AppendTypesSlow<" + candidate + "> " + var + ";\n").c_str(), /*silent=*/true)) {
// nodebug: with -g the variable's debug info would carry the full DIE
// tree of every template argument (all member declarations included) --
// a large, uncacheable per-lookup cost on heavyweight types.
if (!Cpp::Declare(("__Cppyy_AppendTypesSlow<" + candidate + "> __attribute__((nodebug)) " + var + ";\n").c_str(), /*silent=*/true)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That causes the wrappers to be bigger and thus memory hoarding of already a heavy operation. Is that a huge problem for the debug setup?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It's a large, measured problem: with -g, each probe variable's debug info pulls the complete DIE tree of its template argument (all member declarations, transitively) into the PTU — on our production replay (large-header trading workload, heavy AppendTypesSlow traffic) that was a 10x wall-clock regression, 1378s → 137s after suppressing, plus the DWARF itself hoarded per lookup. Against that, the attribute adds 26 bytes to a per-probe source buffer that already exists — paid on non-debug setups too, but it's noise next to the buffer itself. If even that bothers you I can gate the attribute text on whether the interpreter session has debug info enabled, at the cost of a slightly less uniform probe string.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In that case, we can cheat on the JitCall side where just after we parse the prototype, we can check if we passed -g to the interpreter, and then call setAttr(createAttr(nodebug)) on wrapper declaration. That would save bytes I believe.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No wait, on a second thought that might be suboptimal. Let's move forward with the current approach -- it would give us one more incentive to get rid of this string manipulations..

TCppType_t varN =
Cpp::GetVariableType(Cpp::GetNamed(var.c_str(), /*parent=*/nullptr));
TCppScope_t instance_class = Cpp::GetScopeFromType(varN);
Expand Down
Loading