I don't know what could cause that but i'm suspecting that hardware acceleration has a lot to do with it. It seems that javascript is one of the things that is fully output with software only. If there was hardware acceleration then it would be blazing fast.
It's like trying to render out a 3d game with software (ie. CPU only). It doesn't matter what computer you use, it's going to get crushed trying to spit out those polygons. But on hardware acceleration it's all offloaded onto the GPU which is specially designed to handle just such things, which is how we enjoy things like that these days.
I was forced to register because of this thread and some comments in it. The Chrome fanboys here are quite ridiculous.
Chrome does not have hardware-accelerated javascript. Hardware-accelerated javascript does not exist. You are mistaking it with WebGL which is present in Safari, Firefox (3 and 4) and Chrome. WebGL has nothing to do with javascript, it is a hardware accelerated <canvas> element (HTML5). Chrome has barely any more hardware acceleration than Microsoft Powerpoint.
Furthermore, the Christmas tree is not rendered with polygons, it is rendered with sprites. It says so right on the front page.
Yeah, thanks for the comment. I know that you can hardware-accelerate sprites by turning them into a textured polygon. Hardware accelerated sprites seem to be both common and rare. The only example I can think of is the mouse pointer.
It's just that usually when you see a game or something that uses sprites, it's not 3D accelerated. Even more so the older it is.
Perhaps someone can write a WebGL canvas version of this toy. It'll probably be faster >_>
Actually, the vast majority of modern 2d games are hardware-accelerated. Software rendering is long since dead. I'd say you've got a 95%+ chance of any 2d game in the last five years being hardware-accelerated.
The vast majority of what you think are modern 2D games are not 2D. They are rendered in a 3D environment with a fixed camera perspective using 3D textured polygons (again, not sprites); not because it's easier to do it that way but because it's much, much faster. The rest of them use non-hardware accelerated java or non-hardware accelerated flash. Which use sprites. Which use the CPU.
So, because hardware-accelerated 2D games use some GPU tricks that involve them being rendered in the same manner as 3D graphics, that makes them suddenly 3D? All it is is a different architecture for doing exactly the same thing. Because a shader and a textured quad get involved, suddenly it's 3D?
WebGL is not the only hardware acceleration tech making its way into browsers, canvas is also getting hardware acceleration. IE9 and chrome both use hardware accelerated canvas, from what I understand.
What exactly is the point you're trying to make? You started out arguing that hardware accelerated javascript does not exist. I don't see anybody trying to make the argument that it does.
It seems that javascript is one of the things that is fully output with software only. If there was hardware acceleration then it would be blazing fast.
This comment was probably not talking about hardware-accelerating javascript, it was talking about the output that javascript controls: when the script says "draw this image here," does the CPU set each pixel or does the GPU?
So what exactly is the difference between a 2D game and a game "rendered in a 3D environment with a fixed camera perspective using 3D textured polygons"?
If it looks like a duck and quacks like a duck, it's a duck. I'd call that a 2D game.
You're somewhat out of date. They're trying to get hardware acceleration working for things as simple as webpage layouts. No, the javascript isn't accelerated, but the actual compositing of the sprites certainly would be. And that tree uses a shitload of sprites with alpha channels.
Take a closer look at the link you posted. It still has nothing to do with javascript, and everything to do with what I said it did. The examples at the bottom of this description and the description itself say that the acceleration's focus is 1. HTML5 and 2. CSS3.
This is in addition to the original hardware acceleration which copies parts of a page already rendered by the CPU directly into the GPU framebuffer. The CPU still does the javascript, and the javascript still does the semitransparent sprites.
Chrome does not have hardware-accelerated javascript. Hardware-accelerated javascript does not exist. You are mistaking it with WebGL which is present in Safari, Firefox (3 and 4) and Chrome. WebGL has nothing to do with javascript, it is a hardware accelerated <canvas> element (HTML5). Chrome has barely any more hardware acceleration than Microsoft Powerpoint.
You're right that there's no hardware-accelerated javascript. Everything else in that paragraph is wrong. Chrome's hardware acceleration isn't WebGL, this acceleration isn't based on <canvas>, and Chrome is working on having significantly more hardware acceleration than Microsoft Powerpoint.
Hardware acceleration doesn't imply polygons. You can do it with sprites also. That's what the Chrome team is working on.
And just to stave off the inevitable, while it might not be accelerating Javascript itself, it certainly can accelerate the sprites that are placed by Javascript.
Just to clear up, I didn't mean that the browser renders polys, just an example of cpu vs. gpu usage. And I was only wondering if it were the case. I'm not even using chrome, fyi so i'm by no means a fan boy. Matter of fact I have yet to install and try it.
But anyway, thank you for the further info. I know about open GL but not WebGL. I'm going to check that out.
It is probably impossible to hardware accelerate JS, at least not without severely cutting its usefulness. However, it's not really that bad. All the fast javascript engines use JIT (which attempts to make it run as fast as natively compiled code if you don't know), and JS by its nature as a general purpose scripting language is more suited to a general purpose processor anyway.
I've got a single core 2.8ghz with 3 gigs and firefox just pinned at 100% then crashed. Chrome renders it flawlessly and fast. I don't believe it is hardware acceleration. Chrome is just seriously optimized for this stuff, etc. Translates the code in to machine code very efficiently.
So there is some way that Chrome can invoke hardware acceleration that the others cannot?
Not trying to smart ass, because I honestly want to know the answer. But hardware acceleration doesn't explain different CPU usage, using different browsers, on the same machine.
Ok, I understand that you can't get something for nothing.
However, is it then, your contention, that Chrome is the only browser that explicitly makes use of hardware acceleration? Seems pretty far-fetched to me.
I didn't say chrome is the only one doing it. They're all doing it, but it's a recent development so everyone has different bits done, and they each have a ways to go.
Also, "hardware acceleration" is a pretty blanket term for a lot of things. It could mean webGL, it could mean compositing using GL, it could mean rendering the page using tiles, etc.
Well I can't confirm, it's just a hunch of mine. Not much else can explain the difference in performance, other than maybe a bigger memory, buffer or cache allocation for javascript. Not really sure what else could account for the performance difference.
I'd like to know too btw if anyone else can chime in.
I might just be ignorant, but I attribute it simply to Chrome's V8 javascript engine, which tends to be faster than other browser's engines. From the wiki:
V8 increases performance by compiling JavaScript to native machine code before executing it, rather than to a bytecode or interpreting it. Further performance increases were achieved by employing optimization techniques such as inline caching. With these features, JavaScript applications running within V8 have an effective speed comparable to a compiled binary
i'm suspecting that hardware acceleration has a lot to do with it.
I'm suspecting you don't know what you're talking about.
Hardware accelaration only works for large amounts of very similar calculations (eg rendering triangles)
Javascript is interpreted code, it needs to run on a general purpose CPU. There is no hardware accelarated javascript. There are only faster software implementations.
8
u/[deleted] Dec 20 '10
I don't know what could cause that but i'm suspecting that hardware acceleration has a lot to do with it. It seems that javascript is one of the things that is fully output with software only. If there was hardware acceleration then it would be blazing fast.
It's like trying to render out a 3d game with software (ie. CPU only). It doesn't matter what computer you use, it's going to get crushed trying to spit out those polygons. But on hardware acceleration it's all offloaded onto the GPU which is specially designed to handle just such things, which is how we enjoy things like that these days.