Hi,

I just did some experiments with the datepicker and discovered that
the setDate and options functions are extremely slow.
When I do a datepicker create, call the getDate function and destroy
the datepicker widget, it takes about 6ms (IE8) / 2ms (FF3).
The same with a setDate or set option instead of the getDate takes
296ms (IE8) / 65ms (FF3) and 299ms (IE8) / 60ms (FF3), respectively.

So the setDate function is roughly 50 times slower than getDate for
IE8. I understand that there are input validations for the setDate
function, but that would be nearly 300ms of date validation?
Is there any trick to speed up the set-up of a datepicker (create and
set start date)?

Another interesting point is, that setting the options during creation
( xxx.datepicker({x:y}) ) seams to have no impact on the runtime,
while setting options with xxx.datepicker("option",{x:y}) takes very
long.


by(e)
Stephan


my testscript:

<script type="text/javascript">
$(function() {
                
        el = $("<input/>").appendTo("body");
        
        var ticks = new Date();
        for (var i=0; i<20; i++) {
                el.datepicker({showWeeks: true});
                el.datepicker("destroy");
        }
        var ticks = ((new Date())-ticks)/i;
        $("<p>datepicker (create/destroy): "+ticks+" ms</p>").appendTo("body");
                        
        var ticks = new Date();
        for (var i=0; i<20; i++) {
                el.datepicker();
                el.datepicker("getDate");
                el.datepicker("destroy");
        }
        var ticks = ((new Date())-ticks)/i;
        $("<p>datepicker (create/getDate/destroy): "+ticks+" 
ms</p>").appendTo("body");

        var ticks = new Date();
        for (var i=0; i<20; i++) {
                el.datepicker();
                el.datepicker("setDate", new Date());
                el.datepicker("destroy");
        }
        var ticks = ((new Date())-ticks)/i;
        $("<p>datepicker (create/setDate/destroy): "+ticks+" 
ms</p>").appendTo("body");

        var ticks = new Date();
        for (var i=0; i<20; i++) {
                el.datepicker();
                el.datepicker("option",{showWeeks: true});
                el.datepicker("destroy");
        }
        var ticks = ((new Date())-ticks)/i;
        $("<p>datepicker (create/option/destroy): "+ticks+" 
ms</p>").appendTo("body");
});
</script>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to