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

More efficient trace toggle

    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      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 

            Assignee:
            julia.garland@mongodb.com Julia Garland
            Reporter:
            support@monkeybreadsoftware.de Christian Schmitz
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: