Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid calling clock::now in the common case. #1862

Closed
wants to merge 1 commit into from
Closed

Avoid calling clock::now in the common case. #1862

wants to merge 1 commit into from

Commits on Sep 19, 2022

  1. Avoid calling clock::now in the common case.

    Summary:
    Avoid calling clock::now in the common case.
    
    Clock::now() can be an expensive call (a call to libc's __clock_gettime). PGO
    data shows that the first check almost always succeeds, which makes the call to
    Clock::now redundant. This patch peels one iteration that calls f() before
    calling clock::now(). Notice that a very common use of this API is a function
    that performs a single load in the function, so timing is not a major concern.
    
    Differential Revision: D39611860
    
    fbshipit-source-id: 105ce07995bdc96627aa8b3011dc565645a498c6
    nadavrot authored and facebook-github-bot committed Sep 19, 2022
    Configuration menu
    Copy the full SHA
    68f1d81 View commit details
    Browse the repository at this point in the history