console.log("raw time", +new Date - start);

+new Date --> Yeah!


>
> start = +new Date;
> for (var i = 0; i < 1000; i++) {
>        var tainted = Object.tainted();
>        for (var key in test) {
>                if (!tainted || !Object.prototype[key]) {
>                        fn(key, test[key]);
>                }
>        }
> }
> console.log("checked time", +new Date - start);
>
> The second version seems be about 15 to 20 % slower, but thats for a
> million iterations... There difference is much smaller for this
> version:
>

20% seems like a relevant percent to me. This is most called method.
Note that having firebug on, messes up numbers. Specially for function calls
(Object.tainted).
I'd try that w/o firebug.

As a small improvement:

 var clean = !Object.tainted();

 Saves you one boolean cast for each iteration.


> I've modified $.each to include the Object.prototype check and ran it
> against ?core&selector, couldn't see any performance difference, if
> anything, it seemed to be faster. Not a good benchmark either, but
> from what I see, just doing the Object.prototype check, maybe caching
> the Object.prototype lookup in a local var, is safe and irrelevant for
> performance.
>

Did you tried that (caching in a var) with a benchmarker ?

-- 
Ariel Flesler
http://flesler.blogspot.com

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

Reply via email to