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

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.5
    • Component/s: Public API
    • Labels:
      None
    • Backwards Compatibility:
      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

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

              Dates

              Created:
              Updated:
              Resolved: