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

Performance: Use get() and put() instead of computeIfAbsent() for HashMaps #82

Open
isabelle-dr opened this issue Jan 9, 2022 · 0 comments

Comments

@isabelle-dr
Copy link

Issue by barbeau
Dec 09, 2020
Originally opened as CUTR-at-USF#392


Summary:

Benchmarks when working on gtfs-validator show that computeIfAbsent() is about 20% more expensive than calling get() and put().:
https://github.com/MobilityData/gtfs-validator/pull/546/files#diff-ab042c46ddc495ec40e8c9a80fdd5ea27dfbac6582dc76a973e523dd34c7b0f9R57

We should optimize the RT validator as necessary.

Steps to reproduce:

Run the validator

Expected behavior:

Have ideal performance when adding to HashMap

Observed behavior:

Benchmarks in context of static GTFS show we're using a slower method

@isabelle-dr isabelle-dr added this to the v1.0 milestone Jan 9, 2022
@barbeau barbeau modified the milestones: v1.0, v1.1 Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants