Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-4697

More efficient trace toggle

    XMLWordPrintableJSON

Details

    Description

      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 

      Attachments

        Activity

          People

            Unassigned Unassigned
            support@monkeybreadsoftware.de Christian Schmitz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: