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

ASP.NET minimal API #21

Closed
wants to merge 2 commits into from
Closed

ASP.NET minimal API #21

wants to merge 2 commits into from

Conversation

MarkPflug
Copy link

An ASP.NET (C#) minimal API implementation that beats the current rust implementation (on my machine), with fewer than half the LOC.

Implementation LOC CSV Load (ms) Req/s
Trustit 213 987 844
Trannet 213 1457 649
TranNetMin 6.0 90 498 838
TranNetMin 7.0 90 551 902

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.

@pkese
Copy link

pkese commented Oct 27, 2022

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.

@xoofx
Copy link

xoofx commented Oct 28, 2022

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™️.

@MarkPflug MarkPflug closed this by deleting the head repository Jan 13, 2023
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

Successfully merging this pull request may close these issues.

3 participants