Skip to content

pcre2test: use microseconds instead of milliseconds for timing #192

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

Merged
merged 1 commit into from
Jan 19, 2023

Conversation

carenas
Copy link
Contributor

@carenas carenas commented Jan 15, 2023

Tested in Linux, macOS, Windows and even NetBSD armv7 (that uses CLOCKS_PER_SEC == 100) and new code is even smaller.

CLOCKS_PER_SEC == 1000000 is mandated by C89 / POSIX so I would expect no portability issues

When using -t or its variants the timing results with a modern CPU
where not very significant even with 4 decimal digits.

While at it, move the factor calculation that can be done with
integer arithmetic and even optimized out for the more common case
when CLOCKS_PER_SEC == 1000000 out of the denominator.
@PhilipHazel PhilipHazel merged commit 703ccd6 into PCRE2Project:master Jan 19, 2023
PhilipHazel added a commit that referenced this pull request Jan 19, 2023
PhilipHazel added a commit that referenced this pull request Jan 19, 2023
@carenas carenas deleted the micro branch January 19, 2023 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants