getIterate.js performance issues
See original GitHub issueI’ve encountered performance issues in my code (which uses filterDeep) and after some research using Chrome DevTools performance tab, it seems that the getIterate.js file causes performance issues.
Here are 2 images displaying the results of the performance test recordings:
I understand that there must be a deep scan to search for a path which might be relevant for the user (was specified in childrenPath). but maybe one of these suggestions can help:
- Add a maxScanDepth (number) option, which will limit the depth of the search for cases where the user knows his deep object’s structure and doesn’t want to scan all the paths in the scanned object.
- Add a isExactChildrenPath (boolean) for cases where only the paths specified by the user in the childrenPath parameter are relevant and there is no need to search other paths (Ofcourse he must supply the full path).
- As mentioned in this stackoverflow question and was tested here
it is possible to use spread instead of concat for better performance.
like this:
currentParents = [...parents, currentObj];
instead ofcurrentParents = parents.concat(currentObj);
orchildPath = [...path, childKey];
instead ofchildPath = (path || []).concat([childKey]);
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
How to Debug Performance Issues in JavaScript - LoadNinja
Learn how to debug performance issues using Google Chrome's DevTools and browser-based load testing tools.
Read more >JavaScript for loop performance issue - Stack Overflow
The problem i am facing is the low performance. See the example code snippets. Following two methods has the performance issue.
Read more >Measuring Performance of Different JavaScript Loop Types
Now, let's use these methods to measure the performance of different types of Loops in JavaScript. Let's Compare the Performance of JS Loops....
Read more >Performance of for loops with JavaScript - Incredible Web
The objective of this experiment is to test the different performances of the Lodash's foreach loop, the ES6 for...of loop, the traditional for ......
Read more >3 JavaScript Performance Mistakes You Should Stop Doing
What if I told you everything you knew was a lie, what will happen if you learn some of the key features our...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, I will review it tonight. Thank you for contribution!
Merged and published as v4.2.14 Please test and put a star if everything still works 😉