Closed dfrankland closed 6 years ago
Another option could be to use BTreeMap
instead of HashMap
. I don’t know which is preferable. Do you have an opinion?
I re-ran my tests and benchmarks using both the sorting of the Vec
from a HashMap
, and also using a BTreeMap
. I think that the BTreeMap
is the more correct way to implement this. It makes it obvious that the outcome is deterministic and allows the user of the library to order the map if needed. Also, it seems to be a few milliseconds faster ⚡️
I've opened another PR #41 for the BTreeMap
implementation, so you can choose which you prefer 👍
Merged #41 instead, thanks.
I've been making a crate that relies on parsing, modifying, and serializing HTML. Testing can become complex because I currently have to traverse two trees and compare elements as well as attributes.
This change makes serialization deterministic, making testing of the resulting string possible.