As I said, Function does not do scope resolution except the global one so in
my opinion should be always preferred for JSON evaluations. Firefox does not
care about implicit returned value plus brackets plus scope, it simply
create the anonimous function doing a syntax check and returns errors only
at call time so if there are no errors the precompiled funcion will be like
a manual one, time for parsing syntax is then one against every eval call.
To be fair, that bench make sense declaring the function once and simply
calling it inside the for to always return the same object. Unfortunately
this is not a real world case.

On May 20, 2009 7:33 AM, "Michael Geary" <[email protected]> wrote:

 Function( 'return ' + data )() is also MUCH faster in Firefox than eval.

In a test case of JSON data containing 1000 names and addresses (about
112KB), eval() takes a full second to execute on my machine in Firefox 3. On
all other browsers (including IE!) it takes hardly any time at all.

The Function version takes essentially no time in Firefox. (Didn't test it
in other browsers.)

-Mike

 ------------------------------
*From:* [email protected] [mailto:[email protected]] *On
Behalf Of *John Resig
*Sent:* Tuesday, May 19, 2009 4:20 PM
*To:* [email protected]
*Subject:* [jquery-dev] Re: window['eval']() in rhino

> I don't remember the original discussion/change, off-hand. If YUIMin is
still able to generate an ...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" 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-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to