-
Notifications
You must be signed in to change notification settings - Fork 336
sizingInvisible horrible performance #389
Comments
Agreed. Any ideas come to mind? |
For modern browsers the library could try to utilize MutationObservers https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver?redirectlocale=en-US&redirectslug=DOM%2FMutationObserver Additionally you could listen for a custom event like 'shown'. This way other libraries could fire this event to notify uniformjs that the selects are visible now. Or a timer could be started to monitor the selects if their visibility changed. Combined it could be something like discussed here: |
Uniform is geared to work with all browsers, starting with the era of IE8. Yes, this poses some challenges, and the above techniques mean that there would still need to be a way to fall back for older browsers and also watch for ways that the DOM gets manipulated by plugins that don't know about Uniform. It's a truly tricky problem. I think that the next version handles this a bit better by just building a hidden DIV with the rendered content. This should let us get the desired width nearly instantly. Having a jsfiddle with hundreds of selects that need styling would be fantastic. With that I would be able to see the problem and test the updated code to see if it still has a performance problem. |
Since there are that many old IE users it's quite a must to support them too (especially as a library like uniform). But still it's not a no-go to benefit from new technologies (with old browser fallbacks). I created a small fiddle showing the problem: Initializing 50 rows with 2 year dropdowns and 2 textboxes each takes: Chrome 32
Firefox 26
|
Beautiful. Thanks for the example. I will make sure to test the next version against this scenario before releasing it. |
@fidian , was anything done in this regard, after your last comment? If not, I will be looking into it. |
@shehi Negative. I did not test the speed. I also didn't have any ideas for how to properly get the size of invisible elements nor did I confirm that the DOM structure changes I was making would produce any tangible benefit. |
Updated JSFiddle. |
For the moment, due to the limitations of old tech (HTML-4, old browsers, old jQuery etc), I see no prospect to push for this improvement, as gains want be worth the effort. I am moving this to our 5.0 development, which will use the cutting edge tech for those who want to move forward. There, with latest jQuery, HTML-5 innovations and DOM improvements, I believe a considerable progress can be achieved. |
Hey there.
I have a rather complex form which utilizes a wizard for usability. There are quite a lot of dropdowns and inputs which I style with uniform. The problem is that those elements are hidden on load which causes uniformjs to use sizingInvisible to get the element sizes.
On my desktop system (2.3GHz core i7-3610QM) it takes several seconds to initialize 100 elements.
2.5 seconds on Firefox 26
3 seconds on Chrome 32
https://github.com/pixelmatrix/uniform/blob/master/jquery.uniform.js#L479
You should try to find a new way of sizing the elements.
The text was updated successfully, but these errors were encountered: