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

Avoid pretty printing overhead in most cases #4063

Merged
merged 1 commit into from
Aug 3, 2024

Conversation

tybug
Copy link
Member

@tybug tybug commented Aug 2, 2024

Found while investigating #4014. This manually hoists the should_note call up a level to avoid computation when not necessary.

This is particularly bad for @given(st.data()), which reprs each draw, and also fixed_dictionaries, which incurred lambda source extractions in record_call via MappedStrategy.map.

This takes #4014 (comment) from 5s -> 4.5s.

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

One minor tweak below, otherwise looks great - thanks @tybug!

hypothesis-python/src/hypothesis/control.py Outdated Show resolved Hide resolved
@Zac-HD Zac-HD merged commit 9c440af into HypothesisWorks:master Aug 3, 2024
58 checks passed
@tybug tybug deleted the pretty-speed branch August 3, 2024 18:27
@Zac-HD Zac-HD mentioned this pull request Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance go faster! use less memory!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants