Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-940

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

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

      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@mongodb.com Durran Jordan
            Reporter:
            cheald Chris Heald
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: