Closed MarkPflug closed 1 year ago
I think the reason you're faster than Rust is that you're cheating a bit: you're preparing full responses while loading the data.
Apparently the 'join' should be performed while serving web requests.
Oh missed that one, actually wrote a similar PR #23 😅, but I haven't change the original request logic to make it on par with Rust, just that I'm initializing collections with proper capacity and it's now faster than Rust on my machine™️.
An ASP.NET (C#) minimal API implementation that beats the current rust implementation (on my machine), with fewer than half the LOC.
See readme.md.
I would observe that this competition is a bit silly, because this API only generates 189 unique route responses. The entire app could be statically generated in a couple seconds. Perhaps an API that returns the next time that a bus will arrive at a given route/stop would make it a bit more dynamic, and realistic? As it stands, a client would be better off downloading the source .zip (13mb) data and doing everything client-side (and potentially offline), rather than requesting JSON payloads that might also measure in the multi-megabyte range.