FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-31773: time.perf_counter() uses again double by vstinner · Pull Request #3964 · python/cpython · GitHub

/ cpython Public

bpo-31773: time.perf_counter() uses again double - #3964

Merged
vstinner merged 2 commits into
python:masterfrom
vstinner:perf_counter_double
Oct 12, 2017
Merged

vstinner merged 2 commits into
python:masterfrom
vstinner:perf_counter_double

Conversation

vstinner commented Oct 12, 2017
edited
Loading

Copy link
Copy Markdown
Member

time.clock() and time.perf_counter() now use again C double
internally.

Remove also _PyTime_GetWinPerfCounterWithInfo(): use
_PyTime_GetPerfCounterDoubleWithInfo() instead on Windows.

https://bugs.python.org/issue31773

Copy link
Copy Markdown
Member Author

This PR fixes a regression of the commit a997c7b which caused precision loss in time.clock() and time.perf_counter() on Windows.

time.clock() and time.perf_counter() now use again C double
internally.

Remove also _PyTime_GetWinPerfCounterWithInfo(): use
_PyTime_GetPerfCounterDoubleWithInfo() instead on Windows.
Comment thread Modules/timemodule.c Outdated
return NULL;
}
return _PyFloat_FromPyTime(t);
return PyFloat_FromDouble(d);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe just return perf_counter(info)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Right, done.

Comment thread Python/pytime.c Outdated
{
#ifdef MS_WINDOWS
return _PyTime_GetWinPerfCounterWithInfo(t, info);
return win_perf_counter(&d, info);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

&d -> d

The compiler emits a warning, but not an error.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Oops, I didn't have time to test my change. It's now fixed (and I tested it this time).

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

serhiy-storchaka removed the request for review from a team October 12, 2017 15:24
Fix also a typo in win_perf_counter()
vstinner merged commit cba9a0c into python:master Oct 12, 2017
vstinner deleted the perf_counter_double branch October 12, 2017 15:51

Copy link
Copy Markdown
Member Author

Thanks for the review @serhiy-storchaka!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL