Loggable builds log messages even if they aren't emitted, reducing performance.

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 2.0.5
    • Affects Version/s: 2.0.4
    • Component/s: Public API
    • None
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      Loggable currently builds messages eagerly, even if the message won't be emitted because of the logger's level setting. This is particularly bad because `log_inspect` uses `respond_to?` on every operation to be logged, which walks the Ruby module tree, which is slow and bad.

      https://github.com/cheald/mongo-ruby-driver/commit/e187ab023d01ec256a3142053e23a12360af8f92

      Using the same benchmark as my previous code, this improved my benchmark runtime by a full 10% (12.1 sec -> 10.9 sec).

              Assignee:
              Durran Jordan
              Reporter:
              Chris Heald
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: