[SERVER-78303] Optimize ScopedTimer Created: 21/Jun/23  Updated: 29/Oct/23  Resolved: 30/Jun/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.0-rc7

Type: Task Priority: Major - P3
Reporter: Colin Stolley Assignee: Colin Stolley
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Backport Requested:
v7.0
Participants:

 Description   

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.



 Comments   
Comment by Githook User [ 03/Jul/23 ]

Author:

{'name': 'Colin Stolley', 'email': 'colin.stolley@mongodb.com', 'username': 'ccstolley'}

Message: SERVER-78303: Optimize ScopedTimer
Branch: EVG-17874-taskgen-test
https://github.com/mongodb/mongo/commit/391dbe555d1d5bb5f29438c83a0e63cca48bed07

Comment by Githook User [ 30/Jun/23 ]

Author:

{'name': 'Colin Stolley', 'email': 'colin.stolley@mongodb.com', 'username': 'ccstolley'}

Message: SERVER-78303: Optimize ScopedTimer
Branch: v7.0
https://github.com/mongodb/mongo/commit/8f789459515b22d97fa4e69398bf3e01e2e15919

Comment by Githook User [ 29/Jun/23 ]

Author:

{'name': 'Colin Stolley', 'email': 'colin.stolley@mongodb.com', 'username': 'ccstolley'}

Message: SERVER-78303: Optimize ScopedTimer
Branch: master
https://github.com/mongodb/mongo/commit/391dbe555d1d5bb5f29438c83a0e63cca48bed07

Generated at Thu Feb 08 06:37:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.