liabru / jquery-match-height

a responsive equal heights plugin
MIT License
3.07k stars 799 forks source link

Alternative throttling #35

Open nickmorss opened 10 years ago

nickmorss commented 10 years ago

Ive noticed the performance of this plugin can effect page rendering performace when used heavily on a page. I have a scenario where there could be up to 300 resizes on a given page. Ive increased the throttling value but also added a check around the height setter.

My assumption is that DOM manipulations are expensive and that i only need to manipulate the height of an element if its not already the height i want it to be. So i have added this check around the setter.

if (_parse($that.css('height')) !== maxHeight - verticalPadding) {
    $that.css('height', maxHeight - verticalPadding);
}

thoughts?

liabru commented 10 years ago

Performance is definitely something I'm looking at working on! Thanks for the tip, I will definitely try out tricks like this.

One thing you should try if you have a lot of elements is avoid using byRow. It's a little more work but if you know the number of elements per row already you can save a lot of DOM work by applying to rows manually.

If you think of any more performance ideas please post them here.

ArmorDarks commented 9 years ago

Are there any chances to see it implemented natively?

nickmorss commented 9 years ago

in conjunction with another implementation as well - http://www.beaverbrooks.co.uk/jewellery/diamond-rings

On Thu, 18 Jun 2015 at 07:57 Serj Lavrin notifications@github.com wrote:

Are there any chances to see it implemented natively?

— Reply to this email directly or view it on GitHub https://github.com/liabru/jquery-match-height/issues/35#issuecomment-113056184 .