GC is shit. You should be ashamed of yourself for not writing this in C.
Name:
FrozenVoid2011-10-29 5:18
>>9
There is no point, C can do it realtime, but you can't embed C in a webpage.
Name:
Anonymous2011-10-29 5:21
>>10
You want to embed this cpu-intensive-as-shit (even once it renders) thing into a webpage? What's wrong with you?
If you want this animation on a website, put up an APNG or GIF animated image.
Name:
FrozenVoid2011-10-29 5:24
>>11
That not for consumers, its a demoscene-like show-off to see how fast you can get with javascript.
Name:
Anonymous2011-10-29 5:51
>>12
In that case, it's not all that special. JS can do basic math and draw images, everyone knows that.
>>14
So you didn't even write it all by yourself, you just improved the performance of another's work.
Name:
FrozenVoid2011-10-29 6:26
>>15
Thats the whole point, you take Code A and improve it to reach much faster speed.
The fastest program is considered the best(as long as it render correct quasicrystal output).
You're welcome to take >>5 and write a faster version yourself, so you see how hard it is.
For example
Code A is optimized to Code B
if B time < A time , A is replaced by B
next version must be faster than new A
Each new optimization level is harder to get, and clever programming tricks come to background.
In javascript there is easy, though artificially limited environment where you can test-debug-compare thousand of scripts per day by simply realoding one .htm file in the browser(which can be sent to anyone and displayed/installed in seconds).
Name:
Anonymous2011-10-29 6:49
>>16
Sure: http://pastebin.com/gnHTKVj6
This version is 3 seconds faster (12 to 12.3, before it was 15.2 to 15.5), yet I won't pretend I made something so great others should adore me and my work.
I'm currently working on precomputed version. >>19 wasn't fast enough on my machine(even 600ms slower, athlon II x2 240 (it doesn't like branching apparently))
This algorithm is extremely simple and there could be further optimizations, but i can't find any yet(except precomputing alot of values)
Name:
Anonymous2011-10-29 11:44
>>21
Strange, especially considering how slow JavaScript functions are.
On my Intel i5 CPU, my version was 3 seconds faster. Optimization is often architecture-specific.
Also, I have never written anything more complex than a Hello World in JavaScript.
I'll rewrite Math.cos/sin calls to my version later, this is just a demo
Name:
FrozenVoid2011-10-29 13:01
Current breakdown for optimizations:
2348 ms cost storing.data[i++]
3777 ms inner loop
1420 ms precomputation/rest
compared:51580ms(Jasons)/8228ms(Current)=x6.26 speed