Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-78303

Optimize ScopedTimer

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0, 7.0.0-rc7
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • v7.0

      ScopedTimer is a hot path, as it is called at least once per query.

      Post v6.0 we added support for both millis and nanos in ScopedTimer, and that increased the cost of this mechanism quite a bit. The nanos precision is only used in the explain() path, so we can optimize millis as the overwhelmingly common case. We can also avoid overhead from factory methods by inlining the logic directly at the call sites. Finally we can also construction Optional<ScopedTimer> objects in place to avoid needless moves.

            Assignee:
            colin.stolley@mongodb.com Colin Stolley
            Reporter:
            colin.stolley@mongodb.com Colin Stolley
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: