-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
Add dynamic properties to decoder #647
Conversation
The delegator is some performance sensitive code, so I'm slightly worried about the Set allocation. |
True now if the javascript code was aware which prop of the object should be decoded that could be a more performant approach. |
@developandplay yea, decoding is in Haskell so people can build their own decoders with |
@developandplay been doing some benchmarks, seems adding this would only result in a +/- 0.1ms penalty. In some cases it is actually faster than the existing code... which is surprising. https://jsfiddle.net/61sw9de5/ ^ you basically move your mouse (or click the button) and it benchmarks the time it takes to accumulate all properties w/ both versions of the code, then displays the improvement (positive or negative). |
Wow this is super cool. Thanks for revisiting the issue! |
No problem, and thanks for this patch ;) It does seem that To get around this we could check the |
Or we can remove the Set, and just use a regular object. function getAllPropertyNames(obj) {
var props = {};
...
return Object.keys(props);
} |
Sounds like a decent alternative. I would expect overshadowing to work as expected. Also let's add a comment then that we are only using it to "simulate" a set. |
Merged in b32d796 |
As mentioned in #646
The additional
getAllPropertyNames
method doesn't look that pretty in my eyes but apparently no such method exists in standard javascript.