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.