Skip to content

Instantly share code, notes, and snippets.

@remy
Last active December 20, 2015 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remy/6075006 to your computer and use it in GitHub Desktop.
Save remy/6075006 to your computer and use it in GitHub Desktop.
JS Bin slow, only in Chrome

A very simple test, just open and close the JavaScript panel in jsbin:

http://d.pr/i/dlRw+

It's slow in Chrome, as so far as I can see, it's slow in Canary. Slow, like 100-200ms slow.

Offline is a completely different story. So I changed jsbin so you can see the difference in production.

There's 3 states of the jsbin JavaScript. To switch between versions, a cookie is dropped against jsbin.com:

  1. Build, no cookie: concat + uglified - jsbin-.min.js
  2. Concat, debug="concat": jsbin-.js
  3. Development, debug="true": each individual script is included as a <script> tag.

So,

  1. I can't for the life of me understand why the concat version is super slow compared to unconcatted.
  2. There is some rendering performance issues in the timeline, but no clues as to why (or that I understand)
  3. This just started happening in a recent update to Chrome (in the same release where the background apps to Chrome are flashing through on refresh - so something seems buggy to me).

I'm really asking to get professional eyes on the thing. I feel like it's a Chrome bug, but I can't narrow it down properly, and I guess some extra eyes might confirm my suspicion or just point out a mistake I've made.

@paulirish
Copy link

@aerotwist and I will definitely figure it out and tell you what's up.

@SunboX
Copy link

SunboX commented Jul 25, 2013

As I understood the JIT compiler is looking up the functions just in time of the first function call? So a larger JS file should take longer to look up for a specific function than a smaller file. So concated should take longer than smaller files. Can this be true?

@paullewis
Copy link

OK, my immediate issue is that on latest Canary (30.0.1575.2) with all flags set to default I can't replicate :-/

Not that it should affect things, but which platform are you checking on?

@remy
Copy link
Author

remy commented Jul 25, 2013

Okay, my canary is the same version and I'm getting the lag - both in normal browsing and incognito.

Chrome stable...oddly isn't doing it in incognito.

In canary I've got no extensions with incognito access.

You're just opening and closing the JS panel, right?

@paullewis
Copy link

Canary and stable I get no lag in normal browsing. Yes, all I'm doing is toggling the JavaScript panel. I took a CPU profile as well, and the flame chart confirms that it's spending virtually no time at all ( < 30ms) getting everything done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment