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

Pull out timing observations, more jsonable arguments #3834

Merged
merged 7 commits into from
Jan 15, 2024

Conversation

Zac-HD
Copy link
Member

@Zac-HD Zac-HD commented Jan 9, 2024

Plus a note in the docs inspired by discussion on tyche-pbt/tyche-extension#3.

Cc @hgoldstein95 for timing metadata per your email.

@Zac-HD Zac-HD requested a review from tybug January 9, 2024 07:03
@Zac-HD Zac-HD force-pushed the obs-timing branch 3 times, most recently from 91dc8e6 to 6f95fc5 Compare January 9, 2024 12:56
@Zac-HD
Copy link
Member Author

Zac-HD commented Jan 9, 2024

Hmm. With a bit of work on the internals, we could instead report the draw time for each argument, corresponding to the entries in the arguments mapping (i.e. each argument to @given() and each interactive draw from st.data(), plus a residual from e.g. st.functions()). @hgoldstein95, do you think that'd be useful?

Copy link
Member

@tybug tybug left a comment

Choose a reason for hiding this comment

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

pulling out timing data into its own key makes a lot of sense, and reporting per-argument draw times would be even better! In a perfect world I would love to observe the timings of every component strategy draw as well 🙂 (I mentioned as much to @hgoldstein95 in our interview).

hypothesis-python/docs/schema_observations.json Outdated Show resolved Hide resolved
@Zac-HD
Copy link
Member Author

Zac-HD commented Jan 10, 2024

pulling out timing data into its own key makes a lot of sense, and reporting per-argument draw times would be even better! In a perfect world I would love to observe the timings of every component strategy draw as well 🙂

Component strategy draws are hard, because we don't have human-readable labels. We could add compute and collect those, but we'd then have the problem that most component strategy draws are internals rather than a meaningful component in the user-facing API/mental model. I remain pretty nervous about introducing too much complexity, and improving life for maintainers and power users at the expense of novices.

Splitting out per-argument timing is definitely doable though, and that is certainly easy to interpret. Keys execute_test, and generate:{argname} for each argname key in the arguments mapping 😁

@Zac-HD Zac-HD force-pushed the obs-timing branch 5 times, most recently from 4129640 to f0037f5 Compare January 15, 2024 08:00
Copy link
Member

@tybug tybug left a comment

Choose a reason for hiding this comment

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

I'll be forced to get familiar with our reporting code at some point, but I'm not there yet, so consider this less of a code review and more of a "ensure I generally understand what's going on" review 🙂

That said, I'm on board with the design here and the choice of label names etc. 👍 just one comment about the layout of the reported draw timings.

Comment on lines +1567 to +1576
count | fraction | slowest draws (seconds)
a | 3 | 65% | -- -- -- 0.357, 2.000
b | 8 | 16% | 0.100, 0.100, 0.100, 0.111, 0.123
c | 3 | 8% | -- -- 0.030, 0.050, 0.200
i | 2 | 2% | -- -- -- -- 0.090
h | 1 | 2% | -- -- -- -- 0.080
(skipped 4 rows of fast draws)"""
got = state.timing_report()
print(got)
assert expected == got
Copy link
Member

Choose a reason for hiding this comment

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

personally, I'd expect this to read left to right: slowest draws on the left, and fastest on the right. I have no scientific backing for this besides an opinion, though.

@Zac-HD Zac-HD merged commit ca37882 into HypothesisWorks:master Jan 15, 2024
47 checks passed
@Zac-HD Zac-HD deleted the obs-timing branch January 15, 2024 23:16
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.

Too-slow health check doesn't say what was too slow
2 participants