Hi Andreas, >> [...] Wouldn't "Function" be the better choice? > > Why would it? There doesn't seem to be a real difference to me (except > regarding scoping, but this should be irrelevant here).
I think it's a bit more than just scoping. As far as I remember the eval() call starts a complete new compiler, parser etc. pp. On the other hand it seems to me that "eval() is evil" is common sense throughout all developers ;) >> I've tried the following replacement in our application that works >> quite good >> (and is about 6 to 7 times faster!): > > Let me guess: You have Firebug enabled, right? As mentioned on this > list a short while ago, Firebug can _severely_ affect JavaScript > performance. Yes, and no. I've done my measurements with several Browsers and most of them do not even have a Firebug (Opera, IE, Chrome, Safari). I agree, that performance is nothing easy to measure. And by the way, that was not my main concern (just a spin-off ;) ) > > For some more performance tests, take a look at this page: > > http://weblogs.asp.net/yuanjian/archive/2009/03/22/json-performance-comparison-of-eval-new-function-and-json.aspx > > The Function approach takes about the same time as the eval() call > (with the exception of the Safari 4 beta where it's way slower - but I > guess this is fixed in the current Safari version). > > Please note that the results for Firefox in the first two tables seem > to indicate that Function() is way faster - but if you scroll down, > there is another table with Firebug turned off, and the results are > quite different! As mentioned, performance was not the main focus. I just followed the "eval() is evil" prayers... ;) As with most of the JavaScripts engine features, it seems to be that the performance issue of eval() is decreasing with every new browser version. My main intention was to 'clean' my code so that most tools (e.g. jslint[1] or even qooxdoos own "lint") will not complain anymore. I will not start to list all the many "eval() is evil" pages around that google spits out when you ask 'em. But as far as I know it's still better, not to use eval()[2]. > Regards, > > Andreas J. Thanks for your replay, Peter ----- [1] http://www.JavaScriptLint.com [2] If anyone can convince me of the contrary, please feel free to do so. But she/he has to have good revisable arguments ;) ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel