heygrady / jquery.truncate

Truncate text to be a specific height.
2 stars 1 forks source link

performance #1

Open inspire22 opened 11 years ago

inspire22 commented 11 years ago

Beautiful work. Any chance you've done (or know how to do) some performance tests? Your looping-based method for using pixel height is clever but I'm worried could be slow if there were, say, 50 elements on the page to check for, etc.

heygrady commented 11 years ago

Doing performance tests isn't that hard to do. Try jsperf. I've tried to make the looking take as few iterations as possible. I think it takes a maximum of 12 or 13 loops, but usually takes only 6 loops to resolve. It is definitely going to be slow given a large amount of items on the page.

I'm open to suggestions for how to make it work better.