-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Not Needed
-
I enjoy using trace option in libmongoc.
But I see that trace is toggled via compiler directive. Since we plan to build libmongoc with trace enabled, the trace data is always prepared, but eventually later not output if trace is disabled.
This could be done more optimized by checking a global variable instead of compiler switch.
Expected:
Optimize trace toggle in mongoc-trace-private.h by updating
if (MONGOC_TRACE_ENABLED)
to
if (MONGOC_TRACE_ENABLED && gLogTrace)
- MONGOC_TRACE_ENABLED is a compile time flag.
- If it is MONGOC_TRACE_ENABLED to false, the compiler can optimize away the whole code black inside if statement.
- Note: We also have a similar function - _mongoc_log_trace_is_enabled
- related to
-
CDRIVER-4800 Return early in mongoc_log_trace functions if no logger is configured
- Closed