Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #17982

Re: Mysterious slowdown in Chromium

From GGolf <invalid@invalid.com>
Newsgroups comp.lang.javascript
Subject Re: Mysterious slowdown in Chromium
Date 2013-01-06 20:22 +0530
Organization Aioe.org NNTP Server
Message-ID <kcc32m$n8q$1@speranza.aioe.org> (permalink)
References <kcc0nh$ckn$1@news.albasani.net>

Show all headers | View raw


On 1/6/2013 7:42 PM, Stefan Weiss wrote:
> I was doing a quick benchmark in Chromium, when I noticed that
> subsequent runs were getting slower and slower. Reduced to the minimal
> case, the effect can be reproduced with this:
>
> <!DOCTYPE html>
> <html>
> <head>
>      <title>Test</title>
> </head>
> <body>
>      <script>
>      function bench() {
>          function test() {}
>          var runs = 10000000,  // adjust as needed
>              t0 = +new Date();
>          while (runs--) test();
>          console.log((+new Date() - t0) + "ms");
>      }
>      </script>
>      <button onclick="bench()">bench()</button>
> </body>
> </html>
>
> These are the times I get for the first 15 runs:
>
> 16ms
> 63ms
> 61ms
> 58ms
> 73ms
> 66ms
> 62ms
> 299ms
> 301ms
> 302ms
> 308ms
> 2681ms
> 2608ms
> 2596ms
> 2608ms
>
> I would have expected no significant change, or maybe even a slight
> speedup due to V8's JIT compiler.
>
> Interestingly, when the test() function is moved outside of bench(), the
> slowdown is much less pronounced:
>
> 13ms
> 20ms
> 18ms
> 18ms
> 17ms
> 23ms
> 21ms
> 297ms
> 301ms
> (and stays at ~ 300ms after that)
>
> Can anybody confirm this? This is on an older version of Chromium
> ("Version 20.0.1132.47 Ubuntu 12.04 (144678)"), so if it's a bug, it may
> have been fixed in more recent versions.
>
>
> - stefan
>

I don't have any explanation to offer, but the following were the 
results on my system:

With the test() function inside of bench(), I got the following run 
times for the first 12 runs:

38ms
56ms
97ms
82ms
72ms
96ms
90ms
96ms
97ms
78ms
86ms
131ms

Subsequent runs were between 94 to 144 ms each.

With the test() function moved outside of bench(), I get the following:
46ms
34ms
30ms
45ms
27ms
42ms
14ms
37ms
32ms
32ms
46ms
111ms

Subsequent runs took between 84 to 143 ms each.

I'm using Google Chrome Version 23.0.1271.97 m on Windows 7.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Mysterious slowdown in Chromium Stefan Weiss <krewecherl@gmail.com> - 2013-01-06 15:12 +0100
  Re: Mysterious slowdown in Chromium GGolf <invalid@invalid.com> - 2013-01-06 20:22 +0530
  Re: Mysterious slowdown in Chromium Gregor Kofler <usenet@gregorkofler.com> - 2013-01-06 16:25 +0100
    Re: Mysterious slowdown in Chromium Stefan Weiss <krewecherl@gmail.com> - 2013-01-06 17:33 +0100
      Re: Mysterious slowdown in Chromium Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-01-06 23:44 +0100
  Re: Mysterious slowdown in Chromium Scott Sauyet <scott.sauyet@gmail.com> - 2013-01-06 08:19 -0800
  Re: Mysterious slowdown in Chromium Patricia Shanahan <pats@acm.org> - 2013-01-06 08:32 -0800

csiph-web