8000 Use clock_gettime instead of clock for benchmarks by isaachier · Pull Request #126 · uber/h3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use clock_gettime instead of clock for benchmarks #126

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 8 commits into from
Aug 23, 2018

Conversation

isaachier
Copy link
Contributor

No description provided.

@coveralls
Copy link
coveralls commented Aug 21, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling ec8742d on isaachier:use-clock-gettime-benchmark into 7756fb1 on uber:master.

BODY; \
} \
END_TIMER(duration); \
printf("\t-- %s: %Le ns per iteration (%d iterations)\n", name, \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we change the formatting for nanoseconds here? In the example you posted on #125 I find it really hard to easily see order-of-magnitude differences. I'd prefer to still express this in ms, or maybe translate this to ops/second?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I get that. I was considering working out a way to change the unit dynamically.

elapsed.tv_sec--; \
elapsed.tv_nsec = 1E9 + elapsed.tv_nsec; \
} \
const long double var = elapsed.tv_sec * 1E9 + elapsed.tv_nsec
Copy link
Collaborator

Choose a reason for hiding this comment

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

This still looks like nanoseconds. Am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wow good catch. I must have forgotten about the final conversion back to microseconds.

elapsed.tv_sec--; \
elapsed.tv_nsec = 1E9 + elapsed.tv_nsec; \
} \
const long double var = (elapsed.tv_sec * 1E9 + elapsed.tv_nsec) / 1E3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add named constants for these scaling factors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had thought that might be more straightforward, just got a bit verbose. Let me post the diff and you can tell me your opinion.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good to me, makes it clearer what the units are

@isaacbrodsky isaacbrodsky merged commit a573ea2 into uber:master Aug 23, 2018
@isaachier isaachier deleted the use-clock-gettime-benchmark branch August 23, 2018 18:00
mrdvt92 pushed a commit to mrdvt92/h3 that referenced this pull request Jun 19, 2022
Use clock_gettime instead of clock for benchmarks
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.

4 participants
0