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

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

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.0.4
    • 2.0.5
    • Public API
    • None
    • Fully Compatible

    Description

      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).

      Attachments

        Activity

          People

            durran.jordan@mongodb.com Durran Jordan
            cheald Chris Heald
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: