PHPC-2337 fixed an issue where I inadvertently forgot to explicitly disable tracing at runtime (PHPC compiles with tracing enabled, so that was the default), despite clearing libmongoc's log handler. This introduced a performance regression whereby trace log messages were still generated, but never written.
A possible improvement in libmongoc would have mongoc_log_trace_iovec() and mongoc_log_trace_bytes() return early if a log handler isn't registered (beyond just checking whether tracing is enabled). mongoc_log() already does this itself for its stop_logging calculation.
One approach may be to turn the following snippet from mongoc_log() into a macro to call from all three functions:
stop_logging = !gLogFunc; stop_logging = stop_logging || (log_level == MONGOC_LOG_LEVEL_TRACE && !_mongoc_log_trace_is_enabled ()); if (stop_logging) { return; }
- is related to
-
PHPC-2337 Performance degradation in 1.17 due to trace logging
- Closed
-
CDRIVER-4697 More efficient trace toggle
- Closed