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

Make Oid zero-copy #17

Closed
jannschu opened this issue Sep 12, 2019 · 1 comment
Closed

Make Oid zero-copy #17

jannschu opened this issue Sep 12, 2019 · 1 comment

Comments

@jannschu
Copy link

jannschu commented Sep 12, 2019

Hi,

when parsing oids the binary representation is converted to Vec<u64>.

I propose to keep the binary representation and provide api for the conversion to Vec<u64> (or an iterator implementation).

In my case I use oids basically only for comparison with other oids.

The downsides I see for my proposal are:

  • the hierachical structure is not as easily visible in this way
  • api break: Oid would get an lifetime parameter (users of der-parser already handle lifetimes a lot, so I don't think this is a big issue)

The advantages:

  • zero-copy, Oid becomes smaller. In particular cloning does not heap allocate which is useful if you use them in many places.
  • parsing is faster
  • edit: a u64 can be too small (?)

I also propose to add a proc macro for easy construction and a Hash implementation.

I can implement the proposed changes if you are interested.

@chifflier
Copy link
Member

Closing, merged in #18

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

No branches or pull requests

2 participants