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

Use precompiled Pattern instances #1789

Merged
merged 2 commits into from
Nov 14, 2019
Merged

Conversation

otbutz
Copy link
Contributor

@otbutz otbutz commented Nov 12, 2019

I'm currently testing the import with all our new encoded values enabled and JFR reported that a lot of Pattern instances are being allocated.

As String.replaceAll() is not reusing it's Pattern instance, we create a new one each time it is called, which quickly becomes expensive.

Screenshot_20191112_163104

@karussell
Copy link
Member

Were you able to measure any speed ups for the import due to these changes?

@otbutz
Copy link
Contributor Author

otbutz commented Nov 14, 2019

Ran the import twice using the following setup:

  • source: germany-latest.pbf
  • CH disabled
  • LM enabled
  • Xms23G Xmx23G
  • all available encoded values
  • Flightrecorder with preset profile
  • measured from first log line until Dropwizard lists the available endpoints

Results

  • unpatched: 17m44s
  • with precompiled patterns: 16m40s (:arrow_down: ~6%)

Memory allocation according to JFR without precompiled Patterns (109GiB total int[] allocation)

Screenshot_20191114_173600

Memory allocation according to JFR with precompiled Patterns (83.3GiB total int[] allocation)

Screenshot_20191114_173619

@karussell karussell added this to the 1.0 milestone Nov 14, 2019
Copy link
Member

@karussell karussell left a comment

Choose a reason for hiding this comment

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

Thanks!

This looks good :)

@karussell karussell merged commit b9c6af3 into graphhopper:master Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants