Slashdot Mirror


Chrome 10 Beta Boosts JavaScript Speed By 64%

CWmike writes "Google released the first beta of Chrome 10 on Thursday, and Computerworld found it to be 64% faster than its predecessor on Google's V8 JavaScript benchmarks. But in another JS benchmark — WebKit's widely-cited SunSpider — Chrome 10 beta was no faster than Chrome 9. Yesterday's Chrome 10 beta release was the first to feature 'Crankshaft,' a new optimization technology. Google engineers have previously explained why SunSpider scores for a Crankshaft-equipped Chrome show little, if any, improvement over other browsers. 'The idea [in Crankshaft] is to heavily optimize code that is frequently executed and not waste time optimizing code that is not,' said the engineers. 'Because of this, benchmarks that finish in just a few milliseconds, such as SunSpider, will show little improvement with Crankshaft. The more work an application does, the bigger the gains will be.' [Chrome 10 beta download here.]"

169 comments

  1. 64%? by Anonymous Coward · · Score: 0

    64% ought to be enough for anyone.

    1. Re:64%? by bonch · · Score: 1, Insightful

      64% speed boost? Text-based AJAX content is going to be even more imperceptibly faster, wow!

      All this optimization work on a subpar language like JavaScript just to display text that much faster. It's admirable but ultimately not as important as people make it out to be.

    2. Re:64%? by clang_jangle · · Score: 1

      Mr Slowski, I presume?

      --
      Caveat Utilitor
    3. Re:64%? by bunratty · · Score: 2

      You'll want fast JavaScript when HTML5 matures and applications that use Canvas become popular. If browsers don't work on making JavaScript fast now, those applications won't materialize later.

      --
      What a fool believes, he sees, no wise man has the power to reason away.
    4. Re:64%? by omfgnosis · · Score: 1

      Considering the vast differences in speed for even "text content" between the current IE release and, well, all of the current competitors, the optimization is well-received by web developers. Never mind the fact that many of us are doing work besides "text content".

      And JavaScript may not be the best candidate for high performance, but I'm genuinely curious what makes it "subpar". I quite like it.

  2. What About /. Performance? by WrongSizeGlass · · Score: 2, Interesting

    Will it make the new /. work any faster ... or better ... or anything?

    1. Re:What About /. Performance? by davester666 · · Score: 1

      No. Nothing can make a difference with the new ./

      --
      Sleep your way to a whiter smile...date a dentist!
    2. Re:What About /. Performance? by hedwards · · Score: 1

      I've noticed that. /. is pretty much the only site I have problems with in terms of performance. It's gotten a bit better since I disabled most of my addons, but still, as speedy as the latest Firefox beta is, it's still pretty sluggish on here.

    3. Re:What About /. Performance? by rsborg · · Score: 1

      I've noticed that. /. is pretty much the only site I have problems with in terms of performance.

      Are you serious?
      Have you tried loading any blog post that runs Disqus or IntenseDebate with tons of comments? Any serious user-moderated forum can be very slow. Slashdot has plenty of company here.

      --
      Make sure everyone's vote counts: Verified Voting
    4. Re:What About /. Performance? by hedwards · · Score: 1

      Yes, I'm being serious. Previous to the change I wasn't having any trouble with slashdot, now I am. This is easily the most demanding site I visit. Probably the only other site I can recall having a lot of trouble with is my broker, and that hasn't been a problem in quite a while.

    5. Re:What About /. Performance? by Firehed · · Score: 1

      The newest version of ./ is (in my experience) at least an order of magnitude faster than the old version, at least as my logged-in settings cause the page to render. I'd like to take a small amount of credit by having spent four seconds in Chrome's JS profiler and then reported an egregious flaw in their JS that caused it to run at 100% CPU continually (in effect: c = function(){someSlowThing();setTimeout(c,0);}; c(); ), but even with that original problem it was still faster for me than the old version. Or, at least, it didn't cause my browser to deadlock when first loading the page.

      YMMV. My experiences were in Chrome 9 (Mac), but they were similar in Firefox and Safari.

      Still, compared to a simple blog or even a pretty complicated web app, the sheer size of the DOM on ./ thanks to hundreds of nested comments is always going to slow things down. I'm sure there are plenty of optimizations they could make (not least of which is finally dropping the fluid-width layout, which makes zooming and many other operations cause a document reflow - incredibly expensive on a giant page), but part of it is just the nature of the beast. Look at Twitter - it gets slower the farther down you scroll, since the DOM gets bigger and bigger thanks to their funky bottomless-page scripts.

      --
      How are sites slashdotted when nobody reads TFAs?
    6. Re:What About /. Performance? by Anonymous Coward · · Score: 0

      I'm using chrome on linux and slashdot works with no performance problems, now bugs on the other hand, such as when commenting a second time it asks for captcha but you can't get past the "click submit to submit comment" (Or something along those lines.).

      Sounds to me like you're either using a bad browser, really slow hardware, or maybe some Intel graphics chip since browsers these days use GPU rendering.

    7. Re:What About /. Performance? by Anonymous Coward · · Score: 0

      My netbook screen with 800 horizontal pixels says please keep the fluid-width layout. How often do you need to zoom anyway?

    8. Re:What About /. Performance? by muindaur · · Score: 2

      A website like /. should NOT require a GPU to display. I come here for text based news and comment, but not a "lets be pretty/fancy" kind of thing. Now, I don't have any issues in FF3.6 on XP Home on my old P4HT and 6800; though in the last version of /. I had to force the old style of comments because the new one was so sluggish. The point is /. is not a site you should need a GPU for period, and it's stupid for any website that does that isn't running a video game in the browser.

    9. Re:What About /. Performance? by Anonymous Coward · · Score: 0

      No. Nothing can make a difference with the new ./

      Actually, and this is quite ironic, IE9RC can. I have Chrome, FF and IE9 RC on two different PCs, and on both IE9 have better performance than the others on the new Slashdot.

    10. Re:What About /. Performance? by jomcty · · Score: 1

      The newest version of ./ is (in my experience) at least an order of magnitude faster than the old version, at least as my logged-in settings cause the page to render.

      I completely agree that the new version of /. is noticeably faster than the previous incarnation.

    11. Re:What About /. Performance? by Sancho · · Score: 1

      Another datapoint: when I try to post a comment on my Droid, each keystroke in the text field lags by 1-2 seconds.

    12. Re:What About /. Performance? by Compaqt · · Score: 1

      Is there any point to Disqus other than to slow comments down?

      --
      I'm not a lawyer, but I play one on the Internet. Blog
    13. Re:What About /. Performance? by Anonymous Coward · · Score: 0

      What are you running it on, a Pentium2? It doesn't seem particularly slow on my netbook with its rather weak 1.6GHz Atom N270 processor and crappy on-board Intel graphics running Firefox 3.6 on Ubuntu 9.10. If anything the new site design is faster than the previous one. The new design is a little buggy, but it doesn't seem slow. The most annoying thing about the new design is some comments having double-spaced lines if the thread isn't fully expanded (but maybe that is just my browser).

  3. Just embed LLVM, for crying out loud. by Anonymous Coward · · Score: 0

    Mozilla, Apple, Opera and Google need to cut it with all of this JavaScript bullshit, and instead just need to agree to embed LLVM in the browser. Then we can target a real platform using not just JavaScript, but a whole host of other languages. Unlike JavaScript, LLVM has been properly designed from the ground up just for such uses! It's highly optimized, and it's getting better every day.

    They all need to agree to do this, however, in order to have enough market share to force Microsoft into adopting similar technology. Right now Firefox and Chrome alone hold 40% to 50% of the browser market. LLVM embedded within them could truly help encourage their adoption, to bump them up into the 75% to 80% market share range.

    1. Re:Just embed LLVM, for crying out loud. by tapo · · Score: 5, Informative

      Google is doing this with Native Client. It allows a browser to run code compiled for x86, ARM, or LLVM bytecode in a sandbox. It's currently in beta in Chrome 10 (you can enable and try it out by going to about:flags), and apparently available for other browsers as well under the BSD license.

      --
      "Joy is contagious," he said, peering into the microscope.
    2. Re:Just embed LLVM, for crying out loud. by BZ · · Score: 1

      LLVM is not target-architecture-independent, last I checked. For example, you can't use the same LLVM bitcode on both big-endian and little-endian hardware. Or use the same LLVM to produce both x86-32 and x86-64 binaries.

      Or has that changed? I admit I haven't looked in a year or so.

    3. Re:Just embed LLVM, for crying out loud. by bonch · · Score: 0

      Yes, let's recreate ActiveX from the 90s because it worked out so well.

    4. Re:Just embed LLVM, for crying out loud. by Anonymous Coward · · Score: 0

      Well, none of the major browsers are architecture-independent as of a few months ago. All of them use JITs, Mozilla dropped TraceMonkey-only in beta 3 or so. IIRC, ARM and x86 are the only architectures that any of them are targeting.

      (All that said I love Javascript)

    5. Re:Just embed LLVM, for crying out loud. by owlstead · · Score: 1

      Just supporting LLVM bitcodes does not seem to be enough. You need to have a full runtime system, not just a virtual instruction set. It goes a long way, mind you, but you'll have to have API support for any kind of multi-media. If you want to take more control, you'll need an access system etc. And these API's need to be consistent with many languages as well.

    6. Re:Just embed LLVM, for crying out loud. by Anonymous Coward · · Score: 0

      The LLVM virtual machine/bytecode is target independent.

    7. Re:Just embed LLVM, for crying out loud. by StripedCow · · Score: 1

      The problem is that it's already patented:
      http://www.faqs.org/patents/app/20080275938

      --
      If Pandora's box is destined to be opened, *I* want to be the one to open it.
    8. Re:Just embed LLVM, for crying out loud. by StripedCow · · Score: 1

      Basically, you can use a retained-mode graphics system, like OpenGL, or like the Canvas of QT, or basically any scene-graph based system, perhaps extended with some means to play video. Using that alone, you can implement a complete browser using a virtual instruction set.

      Thus, instead of porting your javascript code to N browsers, you would, using such technique, only need to support your own browser :)

      --
      If Pandora's box is destined to be opened, *I* want to be the one to open it.
  4. Problems with ajax by Anonymous Coward · · Score: 0

    Chrome is very fast, but can't run ajax with local files. That is a new problem for developers.

    1. Re:Problems with ajax by foniksonik · · Score: 1

      Localhost anyone? Who is not running a server on their Dev machine?

      --
      A fool throws a stone into a well and a thousand sages can not remove it.
    2. Re:Problems with ajax by sconeu · · Score: 1

      Me. I'm a dev, but not a web dev.

      --
      General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
    3. Re:Problems with ajax by Wiiboy1 · · Score: 2

      This is for security. There's a command line flag for disabling this, I'm pretty sure.

      Try --allow-file-access-from-files

      If that doesn't work, you could go to http://codesearch.google.com/codesearch/p?vert=chromium#OAMlx_jo-ck/src/chrome/common/chrome_switches.cc and look for one that does what you want.

    4. Re:Problems with ajax by Firehed · · Score: 1

      Or just edit your hosts file so that you're developing against local.myfuturesite.com. Doing so may also expose other bugs you'd encounter when switching over to production (weird paths, odd webserver config settings, etc)

      --
      How are sites slashdotted when nobody reads TFAs?
  5. WTF Beta! by Anonymous Coward · · Score: 0

    Okay, how daft do you have to be to encourage tons of people to download and install a beta quality item? Yes, some people will want it, but many people will blindly download this just to toy with it and then fail to understand why some things aren't fully functional yet.

    You aren't actually helping developers if you are putting the betas in the hands of people unqualified to give meaningful feedback on them.

    Sincerely, Chrome "Canary" User

    1. Re:WTF Beta! by Anonymous Coward · · Score: 0

      Okay, how daft do you have to be to encourage tons of people to download and install a beta quality item?

      Because by all reports the beta is stable.
      Google Beta status is something of the norm for most of their software. Gmail was 5 years in beta.

    2. Re:WTF Beta! by foniksonik · · Score: 1

      This /. right? Did I wander into Digg all of a sudden?

      --
      A fool throws a stone into a well and a thousand sages can not remove it.
    3. Re:WTF Beta! by outsider007 · · Score: 1

      How are /. readers not qualified to give meaningful feedback? If this was posted on TMZ I might agree with you.

      --
      If you mod me down the terrorists will have won
    4. Re:WTF Beta! by Cinder6 · · Score: 1

      I've been running the dev channel ever since it became available, and in my experience it's more stable than Firefox. It's just a browser; I don't see anything wrong with trying out a potentially unstable version. YMMV.

      --
      If you can't convince them, convict them.
    5. Re:WTF Beta! by 517714 · · Score: 3, Informative

      We tend to shoot for clever or snarky instead of meaningful;)

      --
      The US government have made it clear that we have no inalienable rights; any we do not defend vigorously will be taken.
    6. Re:WTF Beta! by Anonymous Coward · · Score: 1

      No. But the userbases of websites like Digg have slowly eroded and taken over Slashdot.

    7. Re:WTF Beta! by infolation · · Score: 1

      Where are my snarky points when I need them?

  6. Pardon my ignorance(and I don't want a holy war).. by fuzzyfuzzyfungus · · Score: 4, Interesting

    Historically, slashdot(and elsewhere) has seen the battle over performance between the C/C++ classicists, and those who insist that Java or one of its architecturally similar cousins has, with enough work on the JVM, achieved nearly equivalent execution speed.

    Does anybody know where we are with Javascript now? Traditionally, its performance has been pathetic, since it wasn't all that heavily used; but of late competition to have a better javascript implementation has been pretty intense. Is there anything fundamentally wrong with the language, that will doom it to eternal slowness, or is it on the trajectory to near-native speeds eventually?

  7. Chrome 10? I'm using Chrome 11!!! by Jackie_Chan_Fan · · Score: 4, Funny

    Take that! This Chrome goes to EeeeeLeven....

    1. Re:Chrome 10? I'm using Chrome 11!!! by EricX2 · · Score: 1

      Same here. Does that mean beta is finally as fast as the dev version or did they do something in beta 10 that wasn't in dev 10?

    2. Re:Chrome 10? I'm using Chrome 11!!! by Stratoukos · · Score: 1

      Funnily, this was the exact campaign pitch of Opera 11.

      http://files.myopera.com/EspenAO/files/eleven-post-aleks.png

      --
      It may be 7 digits, but at least it's a semiprime
    3. Re:Chrome 10? I'm using Chrome 11!!! by partyguerrilla · · Score: 1

      It wouldn't the first thing Chrome "borrowed" from opera.

  8. Re:Pardon my ignorance(and I don't want a holy war by BZ · · Score: 5, Informative

    Modern JS jits (tracemonkey, crankshaft) seem to be able to get to within about a factor of 10 of well-optimized (gcc -O3) C code on simple numeric stuff. That's about equivalent to C code compiled with -O0 with gcc, and actually for similar reasons if you look at the generated assembly. There's certainly headroom for them to improve more.

    For more complicated workloads, the difference from C may be more or less, depending. I don't have any actual data for that sort of thing, unfortunately.

    There _are_ things "wrong" with javascript that make it hard to optimize (lack of typing, very dynamic, etc). Things like http://blog.mozilla.com/rob-sayre/2010/11/17/dead-code-elimination-for-beginners/ (see the valueOf example) make it a bit of a pain to generate really fast code. But projects like https://wiki.mozilla.org/TypeInference are aiming to deal with these issues. We'll see what things look like a year from now!

  9. Re:Pardon my ignorance(and I don't want a holy war by NoSig · · Score: 3, Interesting

    Java isn't a dynamic language which is the central difference that makes languages like Javascript and Python much slower than C++ and even Java with the compiler technology as it is now and for the forseeable future. A big still relevant problem with Java is the long loading times you end up with starting up large applications. Javascript isn't even compiled to bytecode so that problem would be much worse if big applications were written and run as Javascript. Javascript is getting faster all the time but don't expect anything like C++ or even Java for general purpose programming. Which is fine because that isn't what Javascript is all about.

  10. Re:Pardon my ignorance(and I don't want a holy war by larry+bagina · · Score: 2

    V8 compiles javascript to native code, so in that sense it is native speed. The limiting factor is interacting with the HTML DOM/CSS.

    --
    Do you even lift?

    These aren't the 'roids you're looking for.

  11. Re:Pardon my ignorance(and I don't want a holy war by fuzzyfuzzyfungus · · Score: 5, Interesting

    Given that browsers tend to cache website elements, for better speed when loading objects that haven't changed since last load, and given that, while people want their page now, their computer usually has a fair amount of idle time available, would you expect to see browsers implementing some sort of background optimization mechanism that chews over cached javascript during idle periods in order to reduce the amount of computationally expensive work that needs to be done should the page be reloaded? Or is Javascript not amenable to that level of preemptive processing?

  12. Chrome 10? by Seumas · · Score: 1

    Weren't we just on Chrome 1.0 like . . . 18 months ago?

    1. Re:Chrome 10? by Jackie_Chan_Fan · · Score: 1

      hahah that is funny and so true.

    2. Re:Chrome 10? by newDzerzhinsky · · Score: 1

      Weren't we just on Chrome 1.0 like . . . 18 months ago?

      Well, no. Being pedantic, I think that 18 months ago we were actually on Chrome 2.
      However, I presume the accuracy of versions wasn't really your point and it was more about the rapid releases.
      You could argue whether the fast increase in version numbering is good or bad, but as far as I am concerned, it's great to see a big company pushing out new releases to a major product as fast as they are....

    3. Re:Chrome 10? by Anonymous Coward · · Score: 0

      Srsly. Google released 0.2 just over two years ago and they'll be releasing 11.0 in the coming months. That's a little ridiculous.

    4. Re:Chrome 10? by TopSpin · · Score: 1

      big company pushing out new releases to a major product as fast as they are

      Yeah. They're so great they've caught up with and passed IE (still at v9) in only three years.

      --
      Lurking at the bottom of the gravity well, getting old
    5. Re:Chrome 10? by Surt · · Score: 2

      These are all minor versions. They just omit the 1 dot.

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    6. Re:Chrome 10? by newDzerzhinsky · · Score: 0

      big company pushing out new releases to a major product as fast as they are

      Yeah. They're so great they've caught up with and passed IE (still at v9) in only three years.

      I'm not sure if that was a sarcastic reply or not...I suspect it might have been.
      However, if it was, I already said that I wasn't sure about the version numbering that they were using.
      I am more interested in them proving that you CAN make regular releases and make it work. It's much easier to sell an "agile" development program to people when you have a good example from a well known company.

    7. Re:Chrome 10? by /dev/trash · · Score: 1

      Hell even Gentoo is up to date with Chrome!

    8. Re:Chrome 10? by Kjella · · Score: 1

      I am more interested in them proving that you CAN make regular releases and make it work. It's much easier to sell an "agile" development program to people when you have a good example from a well known company.

      I don't know how Chrome development works, but bi-annual releases aren't a very strong sign of agile. I know quite a bit of corporate software on a spring/fall release schedule but are quite traditional all the same.

      --
      Live today, because you never know what tomorrow brings
    9. Re:Chrome 10? by flimflammer · · Score: 1

      This is apparently the next big thing. Apparently Firefox will begin rapid these same "milestones" as well so they can get to Firefox 10 within the next few years.

    10. Re:Chrome 10? by flimflammer · · Score: 1

      Yikes, brainfart while typing that out.

      Apparently, Firefox will also begin making these rapid "milestones" as well so they can get to Firefox 10 within the next few years.

    11. Re:Chrome 10? by Anonymous Coward · · Score: 0

      Also, as well, and in addition?

    12. Re:Chrome 10? by flimflammer · · Score: 1

      Don't troll me bro, I've got the flu. :(

    13. Re:Chrome 10? by newDzerzhinsky · · Score: 0

      I don't know how Chrome development works, but bi-annual releases aren't a very strong sign of agile. I know quite a bit of corporate software on a spring/fall release schedule but are quite traditional all the same.

      OK.....And where did the "bi-annual" come from?
      Did we not come from a discussion of the fact that in 18 months Chrome has gone from version 2 to version 10?
      Even if we accept that 10 isn't released fully yet, 7 releases in 18 months doesn't seem to fit into "bi-annual", but maybe I just forgot how numbers work ;)

  13. so... by Charliemopps · · Score: 0

    Wait, a company says their thingy is 64% faster! Then other people test it and say no it's not... then the company says "You have to test it OUR way!" Is the next step that Google specifically engineers their code just to run the benchmarks themselves faster with no real improvement anywhere else? Sound familiar? (ATI/Nvidia)

    1. Re:so... by Anonymous Coward · · Score: 4, Insightful

      1) Google didn't say it, computer world did.
      2) Existing benchmarks like SunSpider are not necessarily good indicators of the performance of all real web pages. For small pages with little JS it makes no difference whether the engine is fast or not - all you care about startup latency. The large AJAX pages we're seeing these days are hitting different bottlenecks, and so you need different benchmarks to emulate that workload. The apparent achievement of crankshaft is to improve the performance of long-running JS without increasing the startup latency of short-lived pages. Well done to Chrome for looking at real-world performance instead of worrying about who has the fastest SunSpider numbers.

    2. Re:so... by xantonin · · Score: 3, Insightful

      Wait, a company says their thingy is 64% faster! Then other people test it and say no it's not... then the company says "You have to test it OUR way!" Is the next step that Google specifically engineers their code just to run the benchmarks themselves faster with no real improvement anywhere else? Sound familiar? (ATI/Nvidia)

      You read that backwards. Chrome 10 made no difference over Chrome 9 in benchmarks, but ComputerWorld said it was 64% faster. Google stated that Chrome 10 was more optimized for real code, not benchmarks. Geez man, I didn't even RTFA. I got all that from the summary. Have we gotten so lazy we're not even reading summaries?

    3. Re:so... by ynp7 · · Score: 1

      Have we gotten so lazy we're not even reading summaries?

      Pretty sure we stopped doing that at least 5 years ago.

    4. Re:so... by 517714 · · Score: 1

      If U RTFA 1st post is 2 hard 2 get.

      --
      The US government have made it clear that we have no inalienable rights; any we do not defend vigorously will be taken.
    5. Re:so... by cheekyjohnson · · Score: 1

      Reading the summaries is far too tiresome. The new fad is only reading the headline!

      --
      Filthy, filthy copyrapists!
    6. Re:so... by Surt · · Score: 2

      Have we gotten so lazy we're not even reading summaries?

      I gave up about halfway through there but I can tell you without a doubt that we have not gotten so lazy we're not evenly weighing the pros and cons of our decisions.

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    7. Re:so... by Anonymous Coward · · Score: 0

      No it was just you and a few handfuls of other people. I'd say the majority of slashdot readers actually read the article. Not many end up in the comments anymore, since all these digg kids have shown up.

    8. Re:so... by BZ · · Score: 1

      For what it's worth, V8 is also not a good indicator of the performance of real web pages.

      In fact, no such good indicator exists yet even for today's pages, much less tomorrow's (which is what you _really_ want out of a benchmark: driving improvement where it will help the most with the things you plan to do once the improvement has happened).

    9. Re:so... by Anonymous Coward · · Score: 0

      off topic:
      according to a former pro gamer i know the latest ati drivers 10.2 I believe give a considerable boost in performance even on graphics cards fairly old (HD4760). While I can not see the big performance leaps he said he got I do "see" (literally) an increase in various cases of a few fps.
      I don't know if I should feel happy about this or feel that amd cheated me about the real quality of their hardware. Lately seeing how hitman (1) used to run on a 300MHz CPU I can hardly believe that todays games take so much processing power to run at an acceptable framerate.
      I even run into framerate issues with magicka with everything set to high. Which is by the way a game for sale for a mere 10 euro on steam and features a 4-player coop and a very interesting concept.
      Yeah this is kind of mixed, I like this game and I'm glad amd fixed these drivers a bit.
      although the last time I looked I wasn't able to run runes of magic in wine on linux and see anything (which worked at a reduced framerate on a nvidia 8600GT pefectly fine (40fps) or not so good (10fps) depending on the current map).

    10. Re:so... by Altanar · · Score: 1

      V8 isn't a benchmark. It is a Javascript rendering engine. V8 performance IS Javascript performance in Chrome.

    11. Re:so... by RebelWebmaster · · Score: 1

      Umm, wrong... http://v8.googlecode.com/svn/data/benchmarks/v6/run.html
      Also, a "javascript rendering engine"???

    12. Re:so... by Anonymous Coward · · Score: 0

      Did you even look at the link you posted?

    13. Re:so... by flimflammer · · Score: 1

      ...what? You linked to a specific webpage designed for benchmarking V8 to support a claim that V8 is a benchmarking system?

      V8 is the javascript engine which is used in Chrome. SunSpider is a benchmarking system. Apples and oranges.

    14. Re:so... by BZ · · Score: 1

      There's an implementation of ECMAScript called "V8". There's also a particular benchmark called "V8". You can thank Google for that naming snafu.

  14. How many Chrome betas are their? by schwit1 · · Score: 2
    1. Re:How many Chrome betas are their? by spinkham · · Score: 3, Informative

      11.0.672.2 is a Dev channel release. Call it "alpha" if you like. http://googlechromereleases.blogspot.com/2011/02/dev-channel-update_17.html

      There are 3 release channels: Stable, Beta, and Dev.

      --
      Blessed are the pessimists, for they have made backups.
    2. Re:How many Chrome betas are their? by Anonymous Coward · · Score: 0

      Correction.. 4 channels. Stable, beta, dev, and canary build (call it alpha, bleeding edge, or nightly build) although I haven't had any issues with the canary builds yet

  15. Err .. this is on their own VP8 benchmarks by Anonymous Coward · · Score: 0

    Funny how if this was microsoft claiming a speed boost on their own benchmarks, we'd have a troll-fest here...

    1. Re:Err .. this is on their own VP8 benchmarks by SwedishPenguin · · Score: 1

      Not if there was a reasonable explanation like there is here. Only optimizing code that is repeatedly executed is common practice in any VM an it makes sense.

    2. Re:Err .. this is on their own VP8 benchmarks by Anonymous Coward · · Score: 0

      While I agree this optimization has a reasonable explanation, I disagree that there would not be a slashdot troll-fest when Microsoft claims a speed boost on their own benchmarks if there's a rational explanation.;

  16. Re:Pardon my ignorance(and I don't want a holy war by BZ · · Score: 1

    gcc compiles C to native code, but there's a noticeable speed difference between compiling with -O0 and -O2 for most C code.

    There are plenty of things people are doing in JS nowadays where the DOM is only a limiting factor because JS implementations are 10x faster than they were 4 years ago...

  17. Re:Pardon my ignorance(and I don't want a holy war by TopSpin · · Score: 5, Informative

    Does anybody know where we are with Javascript now?

    There is always the The Computer Language Benchmarks Game. There you will find V8 competitive with Python, Ruby and other such languages, which is to say slower than the usual compiled suspects by about the same degree.

    --
    Lurking at the bottom of the gravity well, getting old
  18. Fuck all things javascript! by schnikies79 · · Score: 0

    Yes, I am aware that it is not Java. I stand by my statement.

    That is all.

    --
    Gone!
  19. wow by smash · · Score: 1

    ... just goes to show the abysmally sup-optimal implementations of javascript we've been living with for the past decade or so.

    Chrome was already way faster than anything else (particularly upon first chrome release, it was like 10x faster than IE i thought?).

    Surely some time soon we're going to stop seeing double-digit percentage improvements in performance, or were the original javascript implementations really THAT BAD?

    --
    I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
    1. Re:wow by Anonymous Coward · · Score: 0

      We may see double digit gains for a while longer.

      Remember that each percent gain is relative to the previous speed. 50% speed gain could be 50% of 10 second or 50% of 10 milliseconds. The percent may be somewhat misleading.

    2. Re:wow by cbhacking · · Score: 1

      10x faster than IE8, much less IE7, is not an accomplishment worth mentioning. On the other hand, 50% faster than IE9 would be very impressive indeed - the RC is effectively at the top of the speed charts (on Sunspider at least) right now.

      --
      There's no place I could be, since I've found Serenity...
    3. Re:wow by Anonymous Coward · · Score: 0

      ... just goes to show the abysmally sup-optimal implementations of javascript we've been living with for the past decade or so.

      Chrome was already way faster than anything else (particularly upon first chrome release, it was like 10x faster than IE i thought?).

      Actually IE9RC is faster than Chrome 9 and Opera 11 on Sunspider (a test independent of both). I haven't seen if Chrome have caught up again with 10/11 though. Link. I know this is a ms link, but this was veryfied by reviewers when it launched (and can be verified by anyone themselves).

    4. Re:wow by Derek+Pomery · · Score: 1

      http://arewefastyet.com/ tracks the new chrome crankshaft.

      The reason the 64 bit machine (dropdown on lower left) is slower at kraken is I think crankshaft isn't 64 bit yet,

      Anyway, if you look at the historical AWFY, Apple's engine has been pretty consistently on top on sunspider, the margins are pretty thin though due to the shortness of the tests, something both Firefox and Chrome complained about.

      I haven't run kraken on the new crankshaft recently (where it appears it would kick ass) but I did run it a few months ago...
      http://m8y.org/tmp/kraken.xhtml

      --
      -- perl -e'print pack"H*","6e656d6f406d38792e6f7267"' /. ate my old sig. Bastards.
    5. Re:wow by n0-0p · · Score: 1

      If you're using SunSpider as your sole benchmark then you're already behind. SunSpider has outlived its usefulness (which the article touches on). In order to get a win of a few hundredths of a percent on SunSpider you have to add in premature optimizations that hurt page-load times and the performance of long running JavaScript applications. (Or you could add some dubious optimizations that are targeted specifically to the test, but that sounds a bit like cheating on a benchmark to me.)

      SunSpider was good for it's time because it set a minimum bar for all browsers. However, the beta versions of all the new browsers are now within a hair's width of each other's performance on SunSpider. Rather than split those hairs, we need a new generation of tests that more accurately models real-world usage and JavaScript in the large. Mozilla and Google are both moving in that direction with Kraken and the V8 benchmark suites (respectively), but it's just a start. I'd like to see comparable benchmarks from every JS engine maker, or maybe a broadly-scoped, independent benchmark.

  20. Re:Pardon my ignorance(and I don't want a holy war by sydneyfong · · Score: 1, Informative

    Are you sure about this?

    I don't recall gcc -O3 and -O0 having a factor of 10 difference for most tasks. And Javascript definitely isn't close to C performance, even unoptimized.

    Besides, gcc -O3 can actually be somewhat slower than -O2, which is why almost nobody uses -O3 except for the Gentoo zealots.

    --
    Don't quote me on this.
  21. Is startup slower? by v(*_*)vvvv · · Score: 1

    Does all this JS optimization happen on loading a page?

    I've noticed pages freezing up longer now, and this is my only guess as to why.

    If this is the case, do these benchmarks take account of this?

    Fast execution is great, but not at the price of waiting for it.

    1. Re:Is startup slower? by klingens · · Score: 2

      Most of these newfangled JavaScript engines are simply JIT compilers, so yes, the compilation time takes some time which usually means the page loads slower. All those "OnLoad" statements have to be parsed and compiled before they can run faster than they could before.
      Ideally you don't notice it cause your awesome new CPU is fast enough to make it a non issue. If you didn't upgrade your PC (or mobile) last week but last decade, you might have a problem tho.

    2. Re:Is startup slower? by v(*_*)vvvv · · Score: 1

      Does this help?
      http://headjs.com/

      Like they say, loading time is crucial to the sense of speed, and with these new browsers I was really expecting the heavy JS to speed up... Instead the heavy JS sites would freeze for a while. Very annoying. Most sites are OK though. Ebay is by far the worst.

  22. Re:Pardon my ignorance(and I don't want a holy war by thoughtsatthemoment · · Score: 4, Interesting

    There are indeed a few fundamental issues with Javascript that make it both useful for coding and at the same itime hopeless toreplace something like C.

    In javascript, accessing the property of an object requires a lookup, and some checking to make sure things exist. Compared to accessing a field in a C struct, that's a lot of overhead (AFAIK, google does do heave optimazation in this area). The reason for doing that is for safety and being dynamic.

    In a large application, ultimately performance comes from memory management. The best way is using memory and resource pooling, fine tuned by the programmer. I doubt javascript can be efficiently used this way. I don't think javascript can be used to code Word or a browser (I mean the browser itself) any time soon.

    Multithreading is also an issue. There is not really anything wrong with the language. It's more of an implementation issue.

  23. Re:Pardon my ignorance(and I don't want a holy war by TooMuchToDo · · Score: 1

    Did you just suggest locally "precompiling" javascript with idle client cpu cycles? (not sarcasm. I think it's a great idea if that is the case). Can you event "precompile" Javascript currently, and if not, why not? /disclaimer: I have a very light understanding of Javascript, more of a infrastructure/networking guy. Go easy.

  24. Re:Pardon my ignorance(and I don't want a holy war by stigmato · · Score: 1

    I find using --funroll-loops gives me the best performance when compiling.

  25. Re:Pardon my ignorance(and I don't want a holy war by BZ · · Score: 5, Informative

    I'm very sure, yes.

    > I don't recall gcc -O3 and -O0 having a factor of 10
    > difference for most tasks.

    They don't. My comment was quite specific: the cited numbers are simple number-crunching code. The fact that -O0 stores to the stack after every numerical operation while -O3 keeps it all in registers is the source of the large performance difference as long as you don't run out of registers and such. The stack stores are also the gating factor in the code generated by Tracemonkey, at least.

    > And Javascript definitely isn't close to C
    > performance, even unoptimized.

    For simple number-crunching code, Tracemonkey as shipping in Firefox 4 runs at the same speed as C compiled with GCC -O0, in my measurements. I'd be happy to point you to some testcases if you really want. Or do you have your own measurements that you've made that are the basis for your claim and that you'd care to share?

    Note that we're talking very simple code here. Once you start getting more complicated the gap gets somewhat bigger.

    As an example of the latter, see https://github.com/chadaustin/Web-Benchmarks which has multiple implementations of the same thing, in C++ (with and without SIMD intrinsics) and JS with and without typed arrays. This is not a tiny test, but not particularly large either.

    On my hardware the no-SIMD C++ compiled with -O0 gives me about 19 million vertices per second. The typed-array JS version is about 9 million vertices per second in a current Firefox 4 nightly.

    For comparison, the same no-SIMD C++ at -O2 is at about 68 million vertices per second. -O3 gives about the same result as -O2 here; -O1 is closer to 66 million.

    > Besides, gcc -O3 can actually be somewhat
    > slower than -O2

    Yes, it can, depending on cache effects, etc. For the sort of code we're talking about here it's not (and in fact typically -O2 and -O3 generate identical assembly for such testcases. See the numbers above.

    One other note about JS performance today: it's heavily dependent on the browser and the exact code and what the jit does or doesn't optimize. In particular, for the testcase above V8 is about 30% faster than Spidermonkey on the regular array version but 5 times slower on the typed array version (possibly because they don't have fast paths in Crankshaft yet for typed arrays, whereas Spidermonkey has made optimizing those a priority).

    Again, I suspect that things will look somewhat different here in a year. We'll see whether I'm right.

  26. Re:Pardon my ignorance(and I don't want a holy war by Anonymous Coward · · Score: 2, Informative

    One problem is that usually websites contain Javascript from ad sites which can't be cached because they want to track every hit. Additionally, since scripts are allowed to do stuff like mess with the prototypes for built-in objects which will affect any code loaded after it, if any of the files are changed you probably have to throw away any precompiled code.

    One the page is loaded, most Javascript engines will try to optimize code that gets run frequently, which is good when you're running a rich Javascript application. It won't necessarily help initial page load times though.

  27. Re:Pardon my ignorance(and I don't want a holy war by BZ · · Score: 1

    It really just depends on your code and on your compiler.... and on your hardware.

    My personal experience is that the same code was fastest with -Os on hardware as of 7 years ago and when compiling with GCC 4.0 (due to i-cache effects, as near as anyone could tell) but fastest with -O3 on hardware as of a year ago and when compiling with GCC 4.5....

  28. Re:Pardon my ignorance(and I don't want a holy war by fuzzyfuzzyfungus · · Score: 1

    I was asking if that were practical, since I don't know much about the guts of this stuff. TFA's mention of optimizing code that runs frequently, and not optimizing rarely used code, gave me the impression that there is some sort of technique, presumably a species of JIT compilation, that is quite computationally expensive; but makes the code subjected to it run faster thereafter. NoSig's comment about load times suggested a similar tradeoff.

    This struck me(on naive first inspection) as being something that would nicely complement the browser cache: if you have the javascript, and idle cycles, and the user isn't sitting and waiting for the page to display, you might as well apply the most aggressive optimization(some nuances would, of course, have to be adopted for battery-powered or thermally constrained devices, where idle cycles are a comparatively costly resource...)

    I don't know enough about the subject to know if there is some reason why this idea is stupid; but if my inference from TFA, that you can trade a one-time, computationally expensive, operation for a speedup on every subsequent run of the code, is correct, it seems as though having a background cache-optimizer would be a comparatively simple extension of the work being done anyway, and would improve user experience for repeatedly loaded sites and/or libraries...

    Assuming such a thing is practical, it would also be interesting to see how it would work built into a caching proxy. I imagine that such an arrangement would open an exciting new scope for bugs and subtle evil; but it would also allow resource-constrained clients to have some of their work done for them by much more capable devices.

  29. Chrome loads pages slower than FF by Troll-Under-D'Bridge · · Score: 1

    IMHE(xperience), Chrome loads pages slower than Firefox with NoScript. Here's why. FF can load partial pages better. By this, I mean FF can load pages with missing or incomplete elements better. While FF will, for example, happily show me a page that is badly formatted because the style sheet hasn't been fully loaded, all that Chrome will show me is a big blank page until it can place the elements correctly on the page. To be sure, FF will dynamically reformat the badly formatted page as the page requisites are loaded, but I can always click the "X" icon to force it to stop loading the page.

    Chrome is also slow to load pages that reference elements from addresses that cannot be accessed. It would take Chrome longer to load a page containing picture X from domain xxx.xxx if I've configured my router to block all access for xxx.xxx.

    1. Re:Chrome loads pages slower than FF by afidel · · Score: 1

      Not sure about that as noscript is a bit draconian, but Chrome 9 and 10 with adblock are both faster than FF 4b10 with adblock.

      --
      There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    2. Re:Chrome loads pages slower than FF by Anonymous Coward · · Score: 0

      I noticed yesterday Chrome re-requests temporarily unavailable assets whereas Firefox didn't appear to do the same, which may account for the rendering pause in some cases.

    3. Re:Chrome loads pages slower than FF by Anonymous Coward · · Score: 0

      To be sure, FF will dynamically reformat the badly formatted page as the page requisites are loaded, but I can always click the "X" icon to force it to stop loading the page.

      The best feature of Firefox: Escape. If I had to use a browser that didn't let me stop animated GIF/PNG I'd go crazy. I'm assuming Chrome doesn't use Escape to stop animations since it's pretty weak on amount of features.

    4. Re:Chrome loads pages slower than FF by thanasakis · · Score: 1

      Mod parent up. Firefox is vastly preferable if you are trying to access the network behind a slow connection, like a GPRS cellphone for example. With Chrome you have to wait until everything is loaded before you are able to see the page, whereas Firefox does a decent job trying to render what it has loaded up to the present point.

  30. Re:Pardon my ignorance(and I don't want a holy war by Anonymous Coward · · Score: 0

    This is an absolutely fantastic idea.... We all tend to visit the same sites frequency. By identifying the common pieces and idle time cache compile them down and down with TypeInference and like optimizations, I think would could easily approach native speeds. Possibly using gpu hardware acceleration to assist in the parallel compiling. How bout maybe in 2-3 years, yes? Ok time to put the pipe down!

  31. Re:Pardon my ignorance(and I don't want a holy war by NoSig · · Score: 1

    Certainly some kind of caching of JIT output should be helpful in some way. There are numerous issues that limit how helpful it can be. For one, it hasn't solved the Java issue and Java is much more amenable to this kind of thing than Javascript is. For one thing Javascript often makes heavy use of document.write which is that Javascript will dynamically write more Javascript to be run later. So the code being run can change from one page load to another even if the code is initially the same, defeating caching of compiled code.

  32. Re:Pardon my ignorance(and I don't want a holy war by Anonymous Coward · · Score: 0

    Yeah, you would need a plugin, like flash, silverlight, webfx, or their like.

  33. Re:Pardon my ignorance(and I don't want a holy war by sydneyfong · · Score: 1

    Interesting. I didn't know they got Javascript to run that fast...

    Admittedly I haven't been following the bleeding edge stuff on the Javascript performance front...

    --
    Don't quote me on this.
  34. Re:Pardon my ignorance(and I don't want a holy war by Anonymous Coward · · Score: 0

    There is no way that Javascript in the browser has anywhere the speed of even unoptimized C for anything more than the simplest 10 line programs. I just can't see how a dynamic language that's interpreted by a browser can even hold a candle to native code. Even the simplest expression in Javascript can be considered equivalent to a library call at least, as it is all being done in software. That's a kind of awkward way to put it, but the best way I can put it is Javascript is so much further from the metal than any language that compiles to native code, that there is no way C like performance could be expected from the language. That's not to say that the language can't achieve satisfactory speeds for some pretty demanding tasks. As computers become more and more powerful, levels of abstraction matter less and less. In other words, it's all relative. :/

  35. Re:Pardon my ignorance(and I don't want a holy war by m50d · · Score: 1

    "cached javascript"? What, just random javascript snippets from the cache? Most javascript delays occur either on page load, or after an ajax call; once your idle all the page load stuff has finished. Pre-emptively executing the onClick()s of all the links on the page and caching the result seems like a sensible optimization, until you realise it's going to play havoc with any ajax-based site. Prefetching linked-to pages in the background is a valid optimization and could include doing those page's onload javascript although, again, you have to worry about what that's going to do to more dynamic sites.

    --
    I am trolling
  36. Re:Pardon my ignorance(and I don't want a holy war by m50d · · Score: 1

    Gah. Once you're idle. Must be tired.

    --
    I am trolling
  37. Great.. by Anonymous Coward · · Score: 1

    Javascript programmers can be 64% lazier and still get the same performance.

  38. Get pwned faster by Anonymous Coward · · Score: 0

    Javascript executed faster == you get attacked faster.

    1. Re:Get pwned faster by ibbie · · Score: 1

      Javascript executed faster === you get attacked faster.

      FTFY. :D

      --
      The wise follow a damned path, for to know is to be forsaken.
  39. Re:Pardon my ignorance(and I don't want a holy war by Anonymous Coward · · Score: 0

    I just have a hard time accepting dynamic languages as a foundation for any significant software project. I'm not saying it's not possible, it's just a nightmare. I much prefer static languages which can be checked by the compiler before run time; plus refactoring is so much easier. All this javascript / dynamic language stuff eventually turns into a big mess, in my opinion.

  40. How fast is the H.264 blocking? by gig · · Score: 1

    How fast will Chrome 10 block an ISO H.264 video as it tries to get from HTML to my video playback hardware? I heard they are working on getting that up to instantaneously.

    1. Re:How fast is the H.264 blocking? by inpher · · Score: 1

      It won't, the web server will see that you are running Chrome and send you the H.264 video wrapped in a Flash object, Chrome will then happily oblige in the name of openness (yeah, right) and play the video.

  41. Re:Pardon my ignorance(and I don't want a holy war by Alef · · Score: 2

    There _are_ things "wrong" with javascript that make it hard to optimize (lack of typing, very dynamic, etc).

    To get a notion of where it is possible to get with a similarly dynamic language, take a look at how the LuaJIT benchmarks compare with optimized C++ and other dynamic languages. Notice it is not far behind a state-of-the-art Java VM.

    Another pretty interesting aspect is this code size versus speed comparison.

  42. Re:Pardon my ignorance(and I don't want a holy war by Kagetsuki · · Score: 1

    Your comparison to gcc optimization levels is apples and oranges, it's a bit misleading and I'd be interested in hearing where you got your information. As a relative comparison I do understand it, and by rough guessing I'd say you sound close to accurate in terms of numbering for single threaded code. Thank you for pointing out how lack of typing and maintaining dynamic nature (dynamic "this" context!? F* you ECMA that's terrible!) enhances the crap factor and makes it much harder to deal with making optimizations of the language. The thing is I don't agree that just making better JIT and optimization engines will fix the problem though - it's like adding more and better lubrication to a brick: slides easier and faster but still a painful and crude brick. Getting wider spread support of different types of scripts more universally accepted and adding proper DOM handling libraries and runtime isolation to them sounds like a good solution to me. If you have Ruby installed for example you can already do scripts with type "text/ruby" (may require some setup in your browser) - it's totally insecure and interacting with elements on the page is non-trivial... but you can do it and I'd take Ruby over JS if it was made to work with the DOM and had isolation from the system.

  43. Re:Pardon my ignorance(and I don't want a holy war by Anonymous Coward · · Score: 0

    There you will find V8 competitive with Python, Ruby and other such languages

    If by competitive you mean faster by an order of magnitude.

  44. thats nice by McTickles · · Score: 1

    but when will we see user friendly features like "delete my pr0n (history/cache) when I close Chrome" or "do not fail miserably at importing my firefox profile data" or "do not block any ports, i know what i am doing"...

  45. Re:Pardon my ignorance(and I don't want a holy war by owlstead · · Score: 0

    Mod parent up, good reasoning here.

  46. Version number inflation? BS. by Altanar · · Score: 1

    Dear /. taggers: Google doesn't care about version number at all. It is just an arbitrary number signifying their major releases (which happens every six weeks or so). Want to know how little Google cares about version number? Go to google.com/chrome . Try to find a version number. Go to Google's Chrome blog ( http://chrome.blogspot.com/ ). Try to find a version number. Google's NEVER promoted a new release of Chrome with the version number. The only people to do so are other sites who are seemingly compelled to attach a number to the new release. The number is there but only for development purposes. Another fun fact about Chrome versioning: Versions between Developer, Beta, and Release never share the same version number. If it changes development channel, the number is increased. You'll never see a version 11.0.331.31 Beta turn into a 11.0.331.31 Release.

    1. Re:Version number inflation? BS. by drinkypoo · · Score: 1

      Dear /. taggers: Google doesn't care about version number at all. It is just an arbitrary number signifying their major releases

      Yes, that is why we call it version inflation. They are meaningless bumps in version number that correspond to nothing. HTH, HAND.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  47. Re:Pardon my ignorance(and I don't want a holy war by pz · · Score: 1

    well-optimized (gcc -O3) C code

    Thinking that gcc produces well-optimized code is a nice sunny view to have, but does not align with reality in my experience. I, too, used to think that gcc was the best compiler out there, mostly because I had not done any head-to-head comparisons, and was echoing what everyone else said.

    Then, I had to write some high-performance C code. I tried everything I could get my hands on. I used every source code transformation and technique I knew. For this application, the more performance I could wring out of the application, the better. Microsoft's C compiler won hands-down on producing the fastest code and without my needing to use crazy constructs to hand-optimize the source. I spent about a week trying to use tricks to produce better-performing code than straight simple, easy-to-understand C did, and ultimately failed. The folks in their compiler group are very, very good. The speed advantage compared to other compilers was about a factor of 2x, if I recall.

    Now my experience is for one very specific application that had a lot of number crunching and a lot of memory accesses, and one application does not prove very much. But gcc is, in my experience, only OK.

    --

    Put my fist through my alarm clock with its ding-dong death inside my ear. - The Blackjacks.
  48. Re:Pardon my ignorance(and I don't want a holy war by Anonymous Coward · · Score: 0

    js is catching up to python, java, quickbasic, perl etc. never to c++.

    but c++ is still faster, of course, or even normal bytecode java. it's just that google has a marketing department for v8, this is already the n:th pretty much identical article about how they've made js faster, yet fail to provide ANY NEW USE CASE BECAUSE OF THE ADDED SPEED, just empty quotes that "it's faster trust us".

    like, why don't they run some box2d js demo on it, would be pretty easy enough to use such to show that hey, you can have 1000 boxes with the old one and 1600 now.

  49. This sounds like by NightFears · · Score: 1

    This sounds like a really hot idea! So hot actually, I wouldn't be surprised were it spotted in another compiler.

  50. Re:Pardon my ignorance(and I don't want a holy war by aitan · · Score: 1

    That's one of the features of IE9 javascript engine, it uses a second CPU core to compile the javascript

  51. Partial Optimization? by AmberBlackCat · · Score: 1

    The idea [in Crankshaft] is to heavily optimize code that is frequently executed and not waste time optimizing code that is not,' said the engineers.

    So even if some of the code is only used on rare occasions, how is it smart to only optimize some of the code instead of all of it? And if the argument is "it takes longer to optimize the code than it does to run it" then one would have to wonder if it takes longer to decide what to optimize than it does to run it.

    1. Re:Partial Optimization? by n0-0p · · Score: 1

      Your guess is correct; for rarely followed code paths it does take significantly longer to (aggressively) optimize the code than it does to run it. Also, premature optimization can generate pathologically suboptimal code, meaning the performance can be much worse than the unoptimized case.

      My understanding of how Crankshaft works is that the emitted code keeps some basic information about the data and frequency for any given code path (it's probably function level, but I don't know the code so I can't say for sure). Once the data and frequency of travel crosses a threshold the code path gets flagged for aggressive optimization. This kind of housekeeping adds very little overhead, so the decision cost overall should be very low. And the useful thing about spot optimizations like this is that their relative infrequency means that you can afford to do really aggressive optimizations that would be far too expensive to run over all of the code at load time.

      The funny thing is that none of this is new. It's all decades-old compiler research stuff that mostly evolved out of the Self language. And Mozilla's tracing engine attempts similar optimizations, although it uses a different technology with different strengths and weaknesses.

  52. Re:Pardon my ignorance(and I don't want a holy war by drinkypoo · · Score: 1

    results vary widely. Try using gcc on SPARC sometimes and prepare to be really unimpressed, at least as compares to acc.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  53. Re:Pardon my ignorance(and I don't want a holy war by Anonymous Coward · · Score: 1

    Well, this is historically true, but projects have started to crop up that take Javascript outside of the browser for various reasons. The projects are generally largely influenced by CommonJS as a standard. RingoJS adheres to the standard and is built ontop of the JVM and Narhwal. Node.js is built ontop of v8 and takes a different approach focusing on the common idea of Javascript as an evented programming environment. While these may not have the libraries that exist for Java/C++ as of yet, they do show promise and the growth of Javascript as a programming language available for various tasks. In fact, when dealing with Windows maintainance/automation already I prefer JScript over VB which has been around for quite some time through wscript and cscript.

    Meanwhile the bytecode comment is a bit wrong. Yes, most modern Javascript engines don't compile down to bytecode, they do however compile down to machine code to be run on bare metal (API extensions/host objects generally need caging however). As for load times, I know that v8 implements snapshots that are compiled down bytecode for the express purpose of it being faster to load up than reparsing.

    Anywho~ Just some research for ya.

  54. Re:Pardon my ignorance(and I don't want a holy war by inpher · · Score: 1

    Will Web Workers mitigate the multithreading issue?

  55. Re:Pardon my ignorance(and I don't want a holy war by SpinyNorman · · Score: 1

    I don't know the latest benchmarks, but most programs arn't app. code bound anyway - they depend more on graphics, I/O (disk, network), external servers (web), etc.

    Where pure CPU speed is an issue a language like C/C++ that was designed to map 1:1 to hardware always has a potential edge at least in allowing a human to cleverly code something, but optimizers are getting better all the time and a JIT compiler has the potential benefit of run-time information which a pre-compiled binary doesn't (not that a pre-compiled binary couldn't be instrumented by the compiler to gather run-time into to be feed back into the optimizer for the next compilation - I believe such compilers already exist).

    Modern CPUs are also crazy fast, so for many apps, even if CPU is the limiting factor, the real-world difference is not important (who cares if your list gets sorted in 0.0001 or 0.0002 seconds)..

    Having said all that, there will always be a few applications that are CPU bound, and where run-times are long enough that the difference in efficiency really does make a difference, and you're never going to see languages that trade efficiency for ease-of-use being widely used in those situations. Java is certainly such a language.

  56. Re:Pardon my ignorance(and I don't want a holy war by BZ · · Score: 1

    > Your comparison to gcc optimization levels is apples
    >. and oranges,

    Well... any inter-level comparison is, to some extent.

    > it's a bit misleading

    How so?

    > I'd be interested in hearing where you got your
    > information.

    Which information? The performance numbers? I wrote some code, and then timed how long it takes to run: the usual way. ;)

    > Getting wider spread support of different types of
    > scripts more universally accepted and adding
    > proper DOM handling libraries and runtime
    > isolation to them sounds like a good solution
    > to me.

    It also greatly expands the complexity of the VM: for example now you have to deal with GC across multiple language runtimes. Even just GC across the two languages in modern browsers (JS and C++) is a huge pain...

    For what it's worth for a while there Gecko supported python for extension authors. No one used it; the support has now been removed as a result (since it made the code more complex and slowed down things people _did_ use). It'll be a hard sell to convince us to put the functionality back given that experience.

  57. Re:Pardon my ignorance(and I don't want a holy war by igouy · · Score: 1

    There's always a more helpful, more specific URL.

  58. Re:Pardon my ignorance(and I don't want a holy war by BZ · · Score: 1

    Oh, I don't think gcc is the best compiler by any means, especially since I have good data to the contrary. As you say, MSVC has much better code generation.

    But on simple numeric benchmarks, GCC does produce pretty good code, as does any other sane compiler. The point being that these benchmarks are _simple_ and hence easy to optimize.

  59. Re:Pardon my ignorance(and I don't want a holy war by thoughtsatthemoment · · Score: 1

    I would think so but I wonder if there are benchmarks to show how much improvment they can bring about.

  60. Re:Pardon my ignorance(and I don't want a holy war by BZ · · Score: 1

    > Well... any inter-level comparison is, to some extent.

    I meant inter-language.

  61. It's not just Javascript by Estanislao+Mart�nez · · Score: 1

    It's not just Javascript. We've been living with abysmally sub-optimal implementations of dynamic languages for about two decades.

    There are lots of techniques for implementing dynamic languages efficiently. Lisp implementations from the 80s, in particular, used tons of techniques to give really good performance. However, all of that has been lost from the collective consciousness of programmers. The leading dynamic languages are Javascript, Python, Ruby and Perl, and their leading implementations have always sucked.

    But basically, as much as Javascript sucks, since it's the web standard and the web is seriously important (read mega-$$$$), there is serious effort to make it go as fast as possible, so techniques are being rediscovered or found.

    1. Re:It's not just Javascript by smash · · Score: 1

      You forgot objective c. :-)

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
    2. Re:It's not just Javascript by Required+Snark · · Score: 1
      What are some of the previously LISP techniques that you think could be exploited for this generation of dynamic languages? I am not asking this as a troll, I really want to know. I've programmed in LISP on Symbolics hardware, which is one reason for my curiosity.

      Do you have any thoughts on dynamic languages that have a primary optimized virtual machine implementations? I'm thinking of PHP and LUA in particular. The language and the VM are very closely linked, and there are no other languages that target the VM. In theory this should result in good performance because the language and VM should be well matched. I know that LUA has a good reputation for speed, but I never see cross language comparisons with PHP and other sever side systems.

      I know that bringing this up has huge troll bait potential, but I'm hoping that there is some meaningful information to be had. On the other hand this is Shashdot....

      --
      Why is Snark Required?
  62. Re:Pardon my ignorance(and I don't want a holy war by ibbie · · Score: 1

    Yeah, lots of very smart people working on making javascript much faster.

    Too bad perl, python, ruby aren't getting faster as fast.

    Luckily, Lua is. :D

    Though I do prefer Python, I've got to hand it to the moonies, they're fricken fast!

    --
    The wise follow a damned path, for to know is to be forsaken.
  63. Re:Pardon my ignorance(and I don't want a holy war by Anonymous Coward · · Score: 0

    Even Gentoo warns against using -O3 on the entire system.

  64. Re:Pardon my ignorance(and I don't want a holy war by VortexCortex · · Score: 1

    The most fundamental problem with Javascript is the fact that modern browsers encounter JS code, compile it into machine code, and run that.

    JS was initially interpreted and therefore the code could be limited in function. Machine code is not limited in function...

    What if C had been chosen instead of JS? I wouldn't want my browser compiling to machine code and running any C code that any website (or 3rd party plugin for that website) delivered to my browser... Why do we allow JS Engines to do this? For Speed!?

    It only takes one error in the JS engine and then we're running machine binary code coming from unknown sources.

    Compare this to an interpreted language where no data (including scripts downloaded from remote sources) except the engine is flagged as executable. There is a much smaller attack surface when you don't just compile and flag executable any code you find littering the Internet (as modern browsers do).

    IMHO, there is no fundamental design issue -- Interpreted Dynamic Typed languages are expected to be slower than Static Typed languages. To increase speed we must trade security, code complexity (and possibly memory). The security trade off for speed approach that modern JS Engines employ is the real appalling fundamental problem to me.

  65. Re:Pardon my ignorance(and I don't want a holy war by patniemeyer · · Score: 1

    Both Java and C/C++ are strongly typed languages, which give a lot of information to the compiler and (in the case of Java) runtime. The question here is how much optimization people can do on a loosely typed language like JavaScript... Apparently they can do quite a bit because JS today is screaming faster than a few years ago.

    You would expect that, all things being equal, the languages with a runtime (including JavaScript) should beat out those without because they can do things that you can't do statically. People who religiously believe that Java couldn't beat C/C++ simply failed to understand what is going on... Both languages have about the same amount of info, both have a compiler, but one has a runtime that is also a compiler that can go on analyzing and optimizing as the program runs... Which one wins in the long run? Duh.

    So the question then is whether JS having a runtime can allow it to work around the lack of type information in the code. Runtimes can do things like observe the type usage and "optomistic inlining" that in some cases may compensate for the loose types. But there may always be cases where there is a penalty for loose types.

  66. Re:Pardon my ignorance(and I don't want a holy war by savage_panda · · Score: 1

    Here's an idea, why don't browsers allow developers to embed direct C code. each browser includes some standard static libraries for the calls the code can make, which would provide the sandboxed environment. When the page loads, the browser can fire up gcc to do the compiling prior to running. Everything would then be native, No more effort spent on trying to optimize a language what wasn't meant to be fast in the first place. it would be much more power efficient to run on mobile devices too as you don't have to have the overhead these dynamic languages impose like garbage collection, and tracing/optimzation.

  67. Forgive My ignorance 2. by Anonymous Coward · · Score: 0

    Why do we care about javascript in webpages. Its irritating and takes forever to load. I find it nearly as bad flash. The only time time i run into using it is when I log into skillport. I am by no means a programmer or a web page designer so I am curious why we care about it. I hardly run into anything that needs it and when I do its usually irritating as hell to deal with. Also, sorry for my ignorance, is there anything in html 5 that could take to place of JAVA like with it is doing with flash.

  68. Re:Pardon my ignorance(and I don't want a holy war by BZ · · Score: 1

    There are several probalems with that idea. First, C allows you to do arbitrary things to the point where it's very much not amenable to sandboxing. And I'm not talking about the standard library. Most simply, you can fill memory with binary code and then jump to it directly. Now we can talk about ways to restrict the C code you can write so as to mitigate things like this, restrict which pages are writable and which are executable, etc, etc, but it won't be quite C anymore, and the exact language subset it will actually be needs to be defined. And all of this will just convert execution of arbitrary code into a SIGSEGV, which is not great for a "sandbox" either.

    Second, compiling C is not necessarily all that fast. Compile time does matter for the web. I would welcome data about relative compile speeds of C and JS, though; I don't have hard data on this.

    Third, how do you propose dealing with memory leaks? Given what most web JS looks like, I would NOT be trusting these people to not leak in their C code. You see GC as an overhead; I see it as a required part of the sandbox.

    Fourth, the browser would have to ship a C compiler, linker, etc, since most end-user systems don't have one. Doable, obviously, but C compilers are not small things.

    Fifth, the cost of downloading C source code that does the equivalent of what a major web app does today in JS could be prohibitive: JS is a much higher language than C and tends to be a lot more concise, even when authored in brain-dead ways.

    Sixth, writing actual portable C is not all that easy, especially because a lot of tutorials recommend doing various non-portable stuff. I very much doubt, again based on the quality of the JS I see on the web, that this would happen. If you're lucky, this would just mean that the site in question would not work right on 64-bit (or 32-bit, or big-endian, or little-endian, or whatever) hardware. If you're not lucky, it will crash.

    What you propose is perhaps worth it, but C is the wrong language. Then you have to ask yourself what the right language is, and whether it's easier to create it or to evolve JS in the direction of being that right language under opt-ins of various sorts: ES5 strict mode, which disallows some hard-to-optimize stuff, the various Harmony proposals, and so forth.

  69. Re:Pardon my ignorance(and I don't want a holy war by BZ · · Score: 1

    > JS is a much higher language than C

    Higher _level_ language. I have got to stop commenting on /. at 2am....

  70. Re:Pardon my ignorance(and I don't want a holy war by TheLink · · Score: 1

    While I've used Lua (for some MMO customizations :) ) and don't really do much javascript, I wonder if one day we might start seeing lots of scripts with "#!/usr/bin/tracemonkey" or similar... :)

    --
  71. Relative running speeds for code by oldestgeek · · Score: 1

    An old rule of thumb was, if an assembler version runs at 1, a C version runs at 10, a threaded interpreter (e.g. Forth) at 100, and BASIC at 1000.

  72. Re:Pardon my ignorance(and I don't want a holy war by savage_panda · · Score: 1

    From a language side, much of the problems you mentioned can be solved via the provided sdk. Like the old CS saying, all computer programming problems can be fixed with adding another layer of indirection. e.g. Memory leaks can be controlled through malloc by just discarding the block after the user leaves the page.

    Difference between this and javascript would be that there's little waste features like a GC that runs in the background. Overall getting C/C++ to compile has much more research and accumulated experience then Javascript. This would close the 10x gap between current native JS vs C app.

    >compiling C is not necessarily all that fast. Compile time does matter for the web. I would welcome data about relative compile speeds of C and JS, though; I don't have hard data on this.

    JS is now both interpreted and compiled. It is first run in interpreted mode, when the optimizer figures out which code/function should be optimized, it would compile that block, and point the execution pointer of that call to the new native code instead of running the interpreted branch. Thus compilation runs on a backend thread and time is somewhat irrelevant. Same could be done for C.

    This actually brings an interesting point, why compile from source each time, huge amount of processing power is wasted from analyzing the syntax and performing the first few passes on the code. This would suck the power from a mobile device quicky. A better solution is to include an intermediary bytecode directly into the page. It would require very little translation/linking to convert into final native code.

  73. Re:Pardon my ignorance(and I don't want a holy war by BZ · · Score: 1

    > much of the problems you mentioned can be
    > solved via the provided sdk.

    How exactly do you solve "jump to arbitrary memory" with an SDK?

    > all computer programming problems can be fixed
    > with adding another layer of indirection

    At the cost of performance, as usual for layers of indirection.

    > Memory leaks can be controlled through malloc
    > by just discarding the block after the user leaves
    > the page.

    There are plenty of pages that users never leave nowadays (gmail, facebook, twitter, etc).

    > JS is now both interpreted and compiled.

    That depends on the implementation.

    > It is first run in interpreted mode,

    This is not true in V8, say. It has no interpreter (which is why it's not portable to architectures for which it has no jit backend, by the way). I can't speak to what Carakan and IE9's JS implementation do here.

    > Thus compilation runs on a backend thread

    Spidermonkey does not compile on a background thread. I can't speak to the others with certainty, but I'm pretty sure V8 doesn't either, nor JavaScriptCore. The closed-source implementation I have less infomation on.

    Trying to do this is a worthy goal, but it's not happening yet, and there are some difficulties with doing it.

    > and time is somewhat irrelevant

    Not really, no. See above.

    > why compile from source each time

    There is talk of caching compiled forms, yes.

    > A better solution is to include an intermediary
    > bytecode directly into the page.

    The choice of the particular bytecode presupposes particular VM implementation strategies, typically. It also makes some optimizations easier while others are harder or impossible.

    Witness the fact that the actual "bytecode" used by current browsers that use it (e.g. V8 does not) is different between different implementations.

    I think you're assuming a uniformity of implementations strategies for JS that's just not there, not least because as you pointed out this is an area of active research.

  74. Too fast! by WillKemp · · Score: 1

    Bugger! Now i only have time to make a coffee while a slashdot page loads - i used to be able to make dinner!

  75. Re:Pardon my ignorance(and I don't want a holy war by Unequivocal · · Score: 1

    http://shootout.alioth.debian.org/u32/which-programming-languages-are-fastest.php

    Javascript V8 (v9 presumably) according to this benchmark is 4x slower than C. Not bad at all, IMO.

  76. Re:Pardon my ignorance(and I don't want a holy war by Unequivocal · · Score: 1

    http://shootout.alioth.debian.org/u32/which-programming-languages-are-fastest.php

    According to this benchmark V8 is 4x slower than C/C++. From my perspective that's "somewhere close" to C's performance. Compared to the 10x+ bench for most scripting languages including other Javascript implementations, it's pretty darn respectable. And if they just improved it by another 60% for many applications, that's a big deal..

  77. Re:Pardon my ignorance(and I don't want a holy war by Unequivocal · · Score: 1

    Yeah - and LuaJIT is mindboggling for a scripted language (admittedly JIT'ed like Java).. http://shootout.alioth.debian.org/u32/which-programming-languages-are-fastest.php