-
Notifications
You must be signed in to change notification settings - Fork 122
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
feat: add a generated OID db to const-oid #451
Conversation
@carl-wallace @tarcieri Please review. |
This seems interesting but might be something good to feature gate. Regarding that, perhaps it would be possible to precompute the output provided it isn’t too large. |
|
@tarcieri I have updated the PR to gate the |
A few questions (then I will be out until tomorrow so expect delay in any reply).
|
|
That's fine
There are two circumstances where I think build-time generation is helpful:
If the data is mostly static and not target-dependent, I think it's needless overhead. This is a feature that isn't relevant to any of The current implementation is very small and quick-to-compile. Adding a build script is another compilation unit (i.e. a crate) which gets pipelined with the other compilation units of the I don't think this particular data set is high maintenance enough to justify adding a build script. My expectation is we'll generate the code once and call it a day. If it turns out we're doing it frequently and it's actually a problem, we can revisit. As far as how to structure the conversion, I'd suggest just checking in a crate underneath [workspace]
members = ["."] ...to put it in its own workspace. Alternatively maybe look at something like |
|
@carl-wallace @tarcieri I have now pushed a new version. It is basically a rewrite.
Why Remove the Feature Gate?
Therefore, this roughly follows the maxim "pay only for what you use." |
This is true. By my measurements debug builds are 70% slower, and release builds 20% slower. However, what this really bloats is the resulting rlib size. It went from 137kB to 1MB. Personally I'd still prefer keeping the feature gate. Since it can be feature gated at a module level, it's also very simple to do, so I don't see any disadvantages in doing it.
It's not quite that simple. The compiler will build and retain all code regardless of use at the level of an individual crate, as it effectively builds code with the equivalent of |
@tarcieri Feature gate re-added. |
tree: BTreeMap<u8, Kind>, | ||
docs: HashMap<u8, (Ident, TokenStream)>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this makes sense, but looks a little weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What looks weird?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly just using BTreeMap
for one and HashMap
for the other
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is by design. The sorting in the BTreeMap
makes the output predicable. OTOH, the HashMap
makes the lookups faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's mostly a moot point, but FWIW the performance seems identical with BTreeMap
in place of HashMap
This databse is generated from the official IANA LDAP registry and from RFC 5280. Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
This databse is generated from the official IANA registry.
Signed-off-by: Nathaniel McCallum nathaniel@profian.com