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: jquery-dev@googlegroups.com [mailto:jquery-...@googlegroups.com] On
Behalf Of John Resig
Sent: Tuesday, May 19, 2009 4:20 PM
To: jquery-dev@googlegroups.com
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 adequate file size using Function then I don't see
why we shouldn't switch.

--John



On Tue, May 19, 2009 at 6:46 PM, Andrea Giammarchi
<andrea.giammar...@gmail.com> wrote:


John, can I ask you why you did not chose Function(string)() ? YUIMin, if I
am not wrong, works with Function because there are less problems with the
external scope ( Function works in the global one, so the only problem is
"arguments" rather than possible variables that are not globals ) 


On Tue, May 19, 2009 at 11:32 PM, John Resig <jere...@gmail.com> wrote:


That's specifically being done to allow YUIMin to properly compress jQuery
(it sees an eval and assumes that it can't be compressed, but using that
technique allows it to work).

--John 



On Tue, May 19, 2009 at 5:22 PM, Justin Meyer <justinbme...@gmail.com>
wrote:



I assume there must be a good reason, but why is window['eval'] used
as opposed to window.eval in httpData?  This has some issues in rhino
for reasons discussed here:

http://www.mail-archive.com/dev-tech-js-engine-rh...@lists.mozilla.org/msg00
664.html

I know jQuery's tests run in rhino, but perhaps not XHR JSON requests?

Is there something that you are doing to rhino (I'm not in strict
mode) that allows this?

Thanks for your help.















--~--~---------~--~----~------------~-------~--~----~
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 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to