-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Question: efficiency when only a few keys are used #29
Comments
Can you elaborate? Because if you can statically prove that you'll only need certain keys, then this library will be kind of redundant won't it? You can just hardcode those in. |
Suppose this crate would support 1 000 different filename extensions as keys. Of those, I need 50. My thinking is ... Manually defining 50 media types isn’t very maintainable. Doing that also wouldn’t allow comparing for equality with proper RFC 6838 media type strings, since their grammar is more complex than just a type and subtype. Currently Update: manually declaring mappings of extensions to |
Are we talking storage or search time constraints? It kind of seems like you're asking about both at once. PHF maps are guaranteed to be I don't know when We could structure the mappings differently so there's a separate map for every top-level type, so two lookups per search but searching fewer elements overall. It'd be relatively trivial at that point to disable certain top-level types based on the intended application, but all that would reduce is binary size (since the O-factor on the top-level search is negligible). |
I’m discussing both space and time yeah. I suspect though that that the media type parsing time cost dwarfs the things you mention. |
I forgot that we're actually already doing this. |
Yeah, when Rust someday gets better const-eval we could potentially run the |
I suppose the full mapping will be included in the binary when only a few keys are used?
The text was updated successfully, but these errors were encountered: