Open nbp opened 10 years ago
PRs accepted to fix those unused variables :-). With or without MFBT-style DebugOnly, probably debug_only per rr style
Right, the codebase has been playing fast and loose with debug-only variables. The plan was to import something like debug_only when needed, as roc says.
But in general, the gains to be made by building rr in a "release" mode are mostly higher-level than enabling optimizations and disabling assertions. The ones I can think of off hand are
(None of those are guarded by simple assert()
calls, though they could be made to be.)
But that said, the one part of the code where I'd really like to turn on optimizations is preload/preload.c. The syscall hooks could easily be hot in some workloads, but the code has lots of dumb register/stack traffic that a decent inlining optimizer could remove. That's just a guess though, would be nice to motivate with some profiler data :).
So in general I wouldn't recommend bothering with building rr in a release mode for now unless (i) a profiler shows it's worthwhile or (ii) you want to take on the higher-level changes mentioned above. (Another reason is to enable turning on super-expensive debug checks, but that's not directly visible to end users.)
mostly higher-level than enabling optimizations and disabling assertions
The reason is that if any rr tracer code is hot, then we're trapping into rr too much and something else is probably wrong :).
While packaging rr, the problem is that in Release mode the
-DNDEBUG
is omitted, and the warning-as-error compilation flag is catching debug-only variable declarations.A work-around is to give the additional argument
-DCMAKE_C_FLAGS_RELEASE:STRING=
to cmake.(spew obtained with
make VERBOSE=1
) When building with the Release mode:When building without the Release mode: