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

chipping away at the perf regression #4286

Merged
merged 6 commits into from
Jan 29, 2021

Conversation

m-sp
Copy link
Member

@m-sp m-sp commented Jan 28, 2021

use oneof instead of cascading, memoize uri parser construction

@m-sp m-sp changed the base branch from main to series/0.22 January 28, 2021 17:47
@m-sp m-sp marked this pull request as draft January 28, 2021 17:47
@m-sp m-sp marked this pull request as ready for review January 28, 2021 20:27
Copy link
Member

@rossabaker rossabaker left a comment

Choose a reason for hiding this comment

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

Has this been identified as a hotspot, or is it speculative? Either way, I agree with it.

Copy link
Member

@rossabaker rossabaker left a comment

Choose a reason for hiding this comment

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

Nope, it hung a test, but I think I see why.

@@ -255,6 +255,7 @@ object Uri extends UriPlatform {
}
}

private[http4s] val uriReferenceUtf8: Parser0[Uri] = uriReference(StandardCharsets.UTF_8)
Copy link
Member

Choose a reason for hiding this comment

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

I bet making this lazy unhangs it. Otherwise, catch it hanging locally and jstack it and you can figure out the circular dependency.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess we could get away with only vals but that would mean reordering all the parsers 😞

Copy link
Member Author

Choose a reason for hiding this comment

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

@m-sp
Copy link
Member Author

m-sp commented Jan 29, 2021

Has this been identified as a hotspot, or is it speculative? Either way, I agree with it.

It immediately showed up as a hotspot in jvisualvm. Turns put recreating parsers is expensive

@rossabaker
Copy link
Member

Okay, that's great to learn. I wonder if we have any more def parsers out there.

@rossabaker rossabaker merged commit 2d8bb3d into http4s:series/0.22 Jan 29, 2021
@m-sp
Copy link
Member Author

m-sp commented Jan 29, 2021

Okay, that's great to learn. I wonder if we have any more def parsers out there.

A quick search didn't reveal any but my grep foo isn't very strong ;)

@m-sp m-sp deleted the try-fixing-perf branch January 29, 2021 15:03
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