Skip to content
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

Performance issue when node passed large number of null elements. #249

Open
claytondol opened this issue Apr 14, 2023 · 0 comments
Open

Comments

@claytondol
Copy link

When working with a table design I found it important to limit the number of rows that were displayed at once due to browser slowdown/lag at large quantities. My first approach was to .map() the array of rows and simply return null after reaching my limit (10 for the sake of the demo)

if (++counter > count) {
    return null;
}

However, when domvm receives the result of this, it chokes for multiple seconds attempting to process them. Using devtools to profile it, it seems to stem from using Array.splice() to filter out the null elements.

image showing profiler results

I was able to change from .map() to .reduce() with great success. Included in the jsfiddle are both approaches - GenerateElements uses .map(), GenerateElementsReduce uses .reduce().

Minimal example demonstrating the issue: https://jsfiddle.net/dpbrxf5u/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant