[LLVMbugs] [Bug 16754] New: Probable pessimization in steady_clock

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 30 11:44:05 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16754

            Bug ID: 16754
           Summary: Probable pessimization in steady_clock
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: hhinnant at apple.com
          Reporter: mike.marcin at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

There is a comment in chrono.cpp

// MachInfo.numer / MachInfo.denom is often 1 on the latest equipment. 
Specialize
//   for that case as an optimization.


This comment points to:

steady_clock::time_point
steady_clock::now() _NOEXCEPT
{
    static FP fp = init_steady_clock();
    return time_point(duration(fp()));
}

Which replaces a double precision multiply with a call through a function
pointer as an optimization.

static
steady_clock::rep
steady_full()
{
    static const double factor = compute_steady_factor();
    return static_cast<steady_clock::rep>(mach_absolute_time() * factor);
}


vs 

static
steady_clock::rep
steady_simplified()
{
    return static_cast<steady_clock::rep>(mach_absolute_time());
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130730/fec5298c/attachment.html>


More information about the llvm-bugs mailing list