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

Fix performance issues with color handling #345

Merged
merged 1 commit into from
Jan 8, 2020

Conversation

stolyaroleh
Copy link
Contributor

..by not autodetecting UseColor on every updateSummary if it is not provided.
detectColor is expensive because it calls hSupportsANSI, which can result in lookup of 3 environment variables and a call to IODevice.isTerminal.

This commit replaces several cases of Maybe UseColor with UseColor and detects/resolves color explicitly in check, recheck and checkGroup.

See my earlier comment for performance numbers I collected while testing.

..by not autodetecting it on every `Hedgehog.Internal.Runner.updateSummary`.
`Hedgehog.Internal.Config.detectColor` is expensive because it calls `hSupportsANSI`,
which can result in lookup of 3 environment variables and a call to `IODevice.isTerminal`.

This commit replaces several cases of `Maybe UseColor` with `UseColor` and
detects/resolves color explicitly in `check`, `recheck` and `checkGroup`.
@stolyaroleh
Copy link
Contributor Author

Related: #240

@HuwCampbell
Copy link
Member

This looks very reasonable.

Copy link
Member

@moodmosaic moodmosaic left a comment

Choose a reason for hiding this comment

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

Looks good 👍 The only concern here is that it'll require a major version bump due to the change in the type signatures /cc @jacobstanley

@jacobstanley
Copy link
Member

I think these are all internal modules so maybe not?

@moodmosaic
Copy link
Member

Yeah, indeed 👍

@jacobstanley jacobstanley merged commit 6d13948 into hedgehogqa:master Jan 8, 2020
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.

None yet

4 participants