Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Chrome Google Upgrades

Background Javascript Compilation Boosts Chrome Performance 136

kc123 writes "The latest version of Chrome includes improvements in JavaScript compilation, according to the Chromium blog. Historically, Chrome compiled JavaScript on the main thread, where it could interfere with the performance of the JavaScript application. For large pieces of code this could become a nuisance, and in complex applications like games it could even lead to stuttering and dropped frames. In the latest Chrome Beta they've enabled concurrent compilation, which offloads a large part of the optimizing compilation phase to a background thread. The result is that JavaScript applications remain responsive and performance gets a boost."
This discussion has been archived. No new comments can be posted.

Background Javascript Compilation Boosts Chrome Performance

Comments Filter:
  • by Sperbels ( 1008585 ) on Thursday February 13, 2014 @05:33PM (#46241171)
    Why would you be dynamically loading new code in the middle of a game loop anyway? You would have know this causes issues when you designed the application and would have loaded it all up prior to executing the loop.
    • by dshk ( 838175 )
      It does not count when you load the code. What it does count is when it gets (Just in Time) compiled.
      • Is it not compiled as soon it browser receives it?
        • by Anonymous Coward

          It is, but is is done using a non-optimizing compiler to get it going quickly. A second pass is then ran through an optimizing compiler for commonly use segments.

          If you had read the fine article you would have known that.

          • by lucm ( 889690 )

            What is the point of reading the article when other people can do it instead and answer questions for stuff that is not obvious in the summary?

            You must be one of the 53%.

        • Re:Performance (Score:4, Informative)

          by Darktan ( 817653 ) on Thursday February 13, 2014 @05:57PM (#46241307)
          Nope. That's the Just In Time part of the JIT. Javascript can't be (efficiently) compiled to native code until the data types of function arguments are know. Since Javascript is a dynamic language, the types can't be known until the function is actually called.
        • by Anonymous Coward

          Is it not compiled as soon it browser receives it?

          Obviously it is not. JIT does not mean "javac" in disguise. JIT can be used to optimize runtime performance of a loop as it is executing, something a static compiler never does.

          • That, and we're talking about Javascript; javac doesn't ever enter into the picture. It's equally true and equally relevant to say that JIT does not mean "python" or "g++" in disguise.
        • Re:Performance (Score:4, Informative)

          by dshk ( 838175 ) on Thursday February 13, 2014 @06:02PM (#46241341)
          No, JavaScript is not compiled before execution, because that would delay startup. It starts in interpreted mode. Then the runtime environment gradually compiles frequently running code. I do not know how advanced are the JavaScript runners, but the Java JIT compiler can even compile the same code fragment several times, using different optimizations as it collects more runtime statistics.
          • by Threni ( 635302 )

            > the Java JIT compiler can even compile the same code fragment several times, using different optimizations as
            > it collects more runtime statistics.

            Yes, it can start off optimized for grabbing VISA credit card numbers, but if it notices more Mastercards coming through the keylogger it can adapt accordingly.

        • JavaScript is quite different in its use from most languages that live in VMs. Java or .NET applications, for example, tend to be quite long-lived and often CPU dependent, so spending a couple of seconds at the start optimising them can be a big win. The VM will then build some profiling data and recompile things based on that, and may do some other tricks.

          With JavaScript, in most cases, the thing that users care the most about is load time. It's often better to use a simple AST interpreter for JavaSc

    • by bondsbw ( 888959 )

      Because the game's UI is a Javascript textbox?

      Duh.

  • Great. Now we have to wait just another 10 years and we get a fantastic JavaScript runtime environment which will be as fast as ... the Java runtime today.
  • The fan on my computer keeps going up with 30% CPU usage on my hexcore system when playing youtube or running anything javascript intense on Chrome.

    The other 2 browsers do not have this issue. Chrome might win on some artificial benchmarks but GPU acceleration and real usage sap too much CPU and I hate hearing my fan keep blowing when I listen to a simple song. FYI I have an ATI 7850 with about:flags set to use GPU and acceleration when available with CSS, smooth scroll, and other settings. IE and FF turn t

    • The fan on my computer keeps going up with 30% CPU usage on my hexcore system when playing youtube or running anything javascript intense on Chrome.

      The other 2 browsers do not have this issue. Chrome might win on some artificial benchmarks but GPU acceleration and real usage sap too much CPU and I hate hearing my fan keep blowing when I listen to a simple song. FYI I have an ATI 7850 with about:flags set to use GPU and acceleration when available with CSS, smooth scroll, and other settings. IE and FF turn this on by default and still.

      I am typing this on IE 10 for this reason. SIGH

      I was with you up until you said IE 10. Everyone knows the Jumper of Chairs rolls IE 11.

      • by Anonymous Coward

        Solution : Unplug fan cable.

        Gooby Pls!

    • by thegarbz ( 1787294 ) on Thursday February 13, 2014 @08:28PM (#46242317)

      I call bullshit. Just tested this myself:

      Chrome Experiments on a CPU intensive page with half screen filled: 23% CPU
      Firefox on the same page: 49% CPU

      Chrome playing a 1080p Youtube Video: 7% CPU
      Firefox playing a 1080p Youtube Video: 3% CPU, Flash plugin for Firefox 8% CPU

      In both cases the GPU load appeared identical. Firefox v26, Chrome v32. I don't have IE10 or the flash player plugin for IE9 so it couldn't be tested.

      • by Elbart ( 1233584 )
        Why are you using Flash for Youtube in Firefox?
        • Simple, I rarely use Firefox and as such everything is set at defaults. Why do I use it for IE? Because you can't do youtube any other way in IE9.

      • You do realize you have to be running dev channel (chromium) to see anything different, right? That aside, I don't see what you did having anything to do with what they did. You're not testing what they are fixing.

        • No I'm calling out the generic bull from the parent. Every time they announce a Chrome release some shill comes in and says IE is faster than Firefox and Chrome just like every time they announce a Firefox release someone bitches that Firefox instantly uses 100GB of ram just to display about:blank or some crap like that.

          The fact is it's wrong. At least on default setups. If the GP somehow stuffed up his install or loaded some resource hungry plugins than that's his problem. No reason to spread miss-informat

    • If you've got lots of plugins for Chrome, try disabling most or all of them and see if that makes a difference. Plugins run in the same process as the browser and can add JS code to 'background' pages that are present in memory even when you're not interacting with the plugin.

  • Is anyone else surprised that it doesn't already do this? Do the other browsers not do this either?
    • Re: (Score:2, Insightful)

      by Anonymous Coward

      As far as I know Firefox already has this feature, and Internet Explorer had it even longer than that. Chrome is no longer the leading web browser, this is a nice illustration of that.

    • by Tailhook ( 98486 )

      Is anyone else surprised...?

      I sure am. I mean these browsers are so expensive you'd think they'd optimize them for something other than making 8-10 levels of recursive <iframes> work so well for advertiser CDNs. I pay a lot of money for my Chrome license, just like you, and I expect more for my money than just a banner ad pump.

  • by Kaenneth ( 82978 ) on Thursday February 13, 2014 @06:46PM (#46241619) Journal

    Do not block the UI thread.

  • Maybe in a future revision. This would bee great !

  • Too Late (Score:2, Insightful)

    by Virtucon ( 127420 )

    I've gone back to Firefox although I hadn't really left it. Why? Spying constantly and most recently disabling extensions without your approval and you have no way to re-enable them. This is because they want all extension developers to use their web store to funnel extensions out to the browsers, creating another fucking walled garden. I think it's not only time to de-Chrome but to de-Google completely, I'm tired of changing policies and them breaking shit just for shits and giggles.

    • My biggest question is why all Google products (Chrome, GTalk etc) install a Windows Service. Most other browsers manage well enough without needing a Windows Service?

      • by Lennie ( 16154 )

        So it can automatically install updates (the service has more permissions than the user, so it can write to the program files directory).

        I believe Firefox does it too (obviously it only has one service. I have seen Chrome set up multiple things (service and scheduled tasks) in multiple places, it's kinda crazy).

  • When its compiled to platform independend sandboxed binaries, why can't the website provide this? This would safe a lot of compiling on the clients.

He has not acquired a fortune; the fortune has acquired him. -- Bion

Working...