4 ms·
It's much faster than Python, Ruby, PHP scripting languages in microbenchmarks testing just the language's features (no C libs). It can get to 1.5x / 2x slower
by coldtea 11y ago
It's much faster than Python, Ruby, PHP scripting languages in microbenchmarks testing just the language's features (no C libs). It can get to 1.5x / 2x slower than C.
You can get whole games like Quake to compile and run in real time in JS and in high resolution, so the Mandelbrot set should pose no issue at all.
You need to take care to work with the JIT though, not sabotage it. Perhaps the code went in an non-optimal way?
For Mandelbrot, eg. instead of an array of tons of objects you could allocate memory in a buffer and have JS manage it.
- mattmanser 11y agoQuake was released in 1996, so what's so amazing about that? Because of Moore's law a 20 year old game running in IE6's javascript engine would probably be fast enough. The equivalent Ruby, Python or PHP could easily run Quake on today's hardware. Also, what do you mean by 'much'. Like orders of magnitude or 30%? Microbenchmarks are fairly useless.
- coldtea 11y ago>Quake was released in 1996, so what's so amazing about that? I didn't say Quake 1. Actually all of Quake 1-4 has been ported to run under JS/WebGL. Besides, it's still amazing given that the rendering happens in high resolutions and gets good refresh rates. Moore's law or not, Python and Ruby can't pull this off with the same speed. >Also, what do you mean by 'much'. Like orders of magnitude or 30%? For things that test the raw language (e.g. its interpreter and implementation, instead of directly calling to some C helper that does everything like e.g. Math.cos would do) it's usually an order of magnitude.