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

Microoptimalization: Avoid creating new calendars in ServiceDate #98

Open
skjolber opened this issue Mar 9, 2018 · 6 comments
Open

Comments

@skjolber
Copy link

skjolber commented Mar 9, 2018

Summary:

ServiceDate.getCalendarForDate(..) used 4.5 % CPU time in one of our benchmarks

Steps to reproduce:

Run performance testing using Open Trip Planner

Expected behavior:

Run fast

Observed behavior:

Wastes time constructing calendars

Platform:

Java 8

@barbeau
Copy link
Member

barbeau commented Mar 9, 2018

@skjolber could you provide the GTFS data you are working with?

I believe this is also the underlying reason why there can be out of memory errors on very large GTFS feeds.

@skjolber
Copy link
Author

skjolber commented Mar 9, 2018

I'll have to ask permission if so.

@skjolber
Copy link
Author

@barbeau What makes you suspect out of memory error on the Calendar? Also, which version of the JDK have you been using?

@barbeau
Copy link
Member

barbeau commented Mar 11, 2018

Mainly my experience with http://gtfs.openov.nl/gtfs/gtfs-openov-nl.zip.

See CUTR-at-USF/gtfs-realtime-validator#123 (comment).

I haven't looked into it in detail but my assumption is that the exploded calendar_dates.txt (instead of representation in calendar.txt) is causing problems. And, if more Calendars are being instantiated that needed that could certainly cause problems - reading your comments again though I'm not sure that's what you meant. If you have any additional insight please let me know.

@skjolber
Copy link
Author

I have not looked into the memory use, the above issue is intended for code that initializes a Calendar and just throws it away again after reading the day, month and year.

@sheldonabrown
Copy link
Member

Any chance you can capture a stack trace during your performance testing? I think you'll find you are in a different section of gtfs-modules.

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

No branches or pull requests

3 participants