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

Stability issues when using Hyperlist with a collection of complex DOM elements #43

Open
Zazzzles opened this issue Nov 13, 2017 · 3 comments

Comments

@Zazzzles
Copy link

Just want to preface this by saying that i love the idea of this plugin. it works very well with simple DOM elements and text but I am running into serious performance issues when trying to render a collection of complex dom elements with this script.

Is there any optimization I can do on my side to potentially improve performance?
Thanks!

@tbranyen
Copy link
Owner

@Zazzzles I've noticed this as well and I believe it's due to the naive overscan implemented. If you are able to show 5k rows in your viewport, it will attempt to load significantly more like 10-15k. This should definitely be configurable.

@nevf
Copy link

nevf commented Jun 17, 2018

My take is the main issue here is Hyperlist uses a recursive requestAnimationFrame() -> render() call which tests the current scroll position. This loads a large number of elements unnecessarily, because it doesn't throttle. It would be way better to use the onScroll event with throttling.  This would also remove the recursive call which I really don't like. My 2c.

@redfellow
Copy link

I was able to make this easier on the CPU with this small tweak (any debounce library / helper function would work, I've got the jQuery one since this is a legacy project):

	// allow recursive function to trigger every 250ms only
	// _this._renderAnimationFrame = window.requestAnimationFrame(render);
	var _debounceRender = jq.debounce(250, function() {
		_this._renderAnimationFrame = window.requestAnimationFrame(render);
	});
	_debounceRender();

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

4 participants