Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!aioe.org!.POSTED!not-for-mail From: Cezary Tomczyk Newsgroups: comp.lang.javascript Subject: Re: Mysterious slowdown in Chromium Date: Sun, 06 Jan 2013 23:44:27 +0100 Organization: Aioe.org NNTP Server Lines: 58 Message-ID: References: NNTP-Posting-Host: RMrsF+s1qSnxq5Qkkqjnpw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.javascript:17990 W dniu 2013-01-06 17:33, Stefan Weiss pisze: > On 2013-01-06 16:25, Gregor Kofler wrote: >> Checked this on Chromium 22 (Ubuntu AMD64) in the web developer console >> >> (function bench() { >> function test() {} >> var runs = 10000000, // adjust as needed >> t0 = +new Date(); >> while (runs--) test(); >> console.log((+new Date() - t0) + "ms"); >> })(); >> >> Execution time stays constant with 90ms to 95ms. [...] Interesting results: function bench() { function test() {}; var runs = 10000000, // adjust as needed t0 = +new Date(); while (runs--) test(); console.log((+new Date() - t0) + "ms"); }; bench(); 15ms var bench = function () { var test = function () {}; var runs = 10000000, // adjust as needed t0 = +new Date(); while (runs--) test(); console.log((+new Date() - t0) + "ms"); }; bench(); 136ms function test() {}; function bench() { var runs = 10000000, // adjust as needed t0 = +new Date(); while (runs--) test(); console.log((+new Date() - t0) + "ms"); }; bench(); 31ms Tested on Google Chrome 23.0.1271.97, Windows 7 64bit. Firefox 17.0.1 and Opera 12.12 was very slow in all above examples. More or less ~ 3 to ~ 13 seconds, while IE9 ~ 440 ms. -- Cezary Tomczyk http://www.ctomczyk.pl/