3 ms·
I think that Javascript, the language, itself has barriers to performance. I think few programmer know, for instance, that a dictionary lookup is 100 times slow
by WilliamLP 16y ago
I think that Javascript, the language, itself has barriers to performance. I think few programmer know, for instance, that a dictionary lookup is 100 times slower than a switch statement. (If you don't believe me test it! It's what I found under Firefox anyway.) The language absolutely begs for a real map type... Objects just don't cut it because of performance (it has to be concerned that someone might have extended the Object prototype) and because of their limitations, e.g. confusion if someone defines a key string called "hasOwnProperty".
If you actually try to use some of it's nice functional features, as well, you can forget about performance. Maybe you think engines can solve these things, but I doubt it will ever compare to any language built from the ground up to have reasonable performance.
- chipsy 16y agoEven so, browser games as-is are bottlenecked by render performance, not language performance; both platforms are capable of running Quake(1 or 2), but JS holds the advantage as far as running it at reasonable resolutions and framerates, while the Flash implementations are hobbled by software rendering.
- warfangle 16y agoEven that bottleneck is going away; see: http://en.wikipedia.org/wiki/WebGL http://en.wikipedia.org/wiki/WebGL Not quite powerful enough to run, e.g., Doom 3 or something.. but headway is being made.