4 ms·
Thanks for the link, I see what you mean about costly. Perhaps a way to hack-fix this is to set a parameter for maxRecursion, to prevent the errors - seems lik
by josscrowcroft 15y ago
Thanks for the link, I see what you mean about costly.
Perhaps a way to hack-fix this is to set a parameter for maxRecursion, to prevent the errors - seems like a pretty solid way of preventing endless loops (RangeErrors) but is probably something that should be off-by-default and switched on globally via a setting or once via a parameter...
I can add it and submit a pull-request for your consideration if you like?
- vjeux 15y agohttp://jsperf.com/object-cycle-detection http://jsperf.com/object-cycle-detection I've added a jsPerf to see how bad it performs. For small objects it's reasonable but if the object has 10 000 elements the Javascript test will take 1 second, which is not acceptable. I'd rather give people a detection cycle detection library if their input may be circular.