Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #14, as well as makes normalizing and adding data to a map twice as fast than before according to my basic benchmarks. 馃槃
The tradeoff is that normalizing now uses function recursion, which means we allocate closures on the stack every iteration and are limited by the stack size, whereas before we used a loop/recur which allowed "unlimited" depth.
I tried using fast-zip to do this in a tail recursive/"stackless" fashion, however it was about 15% to 30% slower in my basic benchmarking and less deterministic (probably due to GC).
I would like to verify this in our production uses to see if we run into any cases where we blow the stack. If it seems fine given reasonable data sizes, I may in the future provide additional functions for normalizing that aren't limited by the stack size to accommodate huge trees of data being added at once.