perf: cache parsed feeds, and speed up the csv and connection paths #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "perf-startup-scan"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #3. With the bus feeds loaded, startup was ~132s and the first query of a service date another ~10s - a container that looks hung.
Changes
trip_id/stop_idlookups memoised. 8.86M rows, so a string per field dominated startup. Parse: ~125s -> ~80s.data/feeds.cache): a json header for the small string-heavy tables, raw typed-array bytes for the rest, keyed by the size and mtime of every feed file. The image build writes it (PTT_BUILD_CACHE=1 node dist-server/index.js), the container reads it. Stale, missing or unreadable cache falls back to parsing and rewrites it, so nothing depends on the file being there.Results (all four feeds, 16,911 stations / 293,660 trips)
Against the running server (warm, today's timetable prepared at boot) Overlook Terrace -> Bronx Zoo answers in 2.2s.
The benchmark cases return identical itineraries to before this branch.
Still open
Query time is now scan cost, not setup: a few seconds for long trips because the scan sweeps every connection in the day. Narrowing it to a corridor around the origin and destination is the next step, and belongs in its own PR.