Skip to content

Use linked-hash-map to implement OrderedDocument #35

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

Closed
zonyitoo opened this issue Mar 5, 2016 · 2 comments
Closed

Use linked-hash-map to implement OrderedDocument #35

zonyitoo opened this issue Mar 5, 2016 · 2 comments

Comments

@zonyitoo
Copy link
Contributor

zonyitoo commented Mar 5, 2016

The ordered::OrderedDocument is a temporary solution while the linked-hash-map crate can only be compiled with nightly. But now, linked-hash-map can be compiled with the latest stable rustc v1.7 (contain-rs/linked-hash-map#28).

So I suggest that we could migrate it to linked-hash-map.

zonyitoo added a commit that referenced this issue Mar 6, 2016
@zonyitoo zonyitoo changed the title Use linked-hash-map to replace OrderedDocument Use linked-hash-map to implement OrderedDocument Mar 6, 2016
zonyitoo added a commit that referenced this issue Mar 6, 2016
@dariusc93
Copy link

How would this impact current use of bson?

@zonyitoo
Copy link
Contributor Author

zonyitoo commented Mar 7, 2016

Currently the OrderedDocument is implemented as Vec + BTreeMap pair to maintain insertion order. Which means that we need to do a O(n) search on the Vec and store the String key twice.

Using LinkedHashMap will help to increase performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants