Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Acid - final release

Name: FrozenVoid 2011-10-28 11:50

Optimized quasicrystal code: full window size render ~17 seconds for 30 frames
http://pastebin.com/fjLQnbkB

Name: FrozenVoid 2011-10-30 16:31

http://pastebin.com/i4rN55Qc
3624ms with no uncached canvas calls.

Name: Anonymous 2011-10-30 20:50

how did you shave off 2 seconds ?

Name: FrozenVoid 2011-10-31 0:08

>>41
removing the rendering before cache: its pretty simple actually, the canvas calls in the middle of render(write->read->write)
stall the outer function(which won't happen after they are cached, since render is now complete(which just takes 3 seconds since ite now write->write->read)).

Name: FrozenVoid 2011-10-31 1:35

http://pastebin.com/Gwpj86rk
3140 ms faster pixel fill

Name: Anonymous 2011-10-31 5:03

fuck off

Name: Atomic_Bios 2011-10-31 7:18

#begin acid(x){
infinite(Summary(imagine(within(entire(reality(x))))))
thoughts(paragon(super(energy(self(warp(earth(x)))))))
imagine(rocket(infinite(warp(self(ahead(all(x)))))))
retort(crazy(ship(thoughts(mind(waves(earth(x)))))))
memory(ideal(mood(create(potent(dream(ship(x)))))))
warp(actual(explain(methods(aspects(brain(x))))))
steady(dream(dazzle(worlds(amaze(all(senses(x)))))))
#return science(proven(laws(talent(x))))
#return arrive(ideal(mood(nest(x))))
} #end

Name: Anonymous 2011-10-31 7:54

>>46
Is this VALID W++ CODE or just something that looks like it?

Name: FrozenVoid 2011-10-31 12:10

3021 ms + cool trippy color effect
http://pastebin.com/LfYeeB8R

Name: FrozenVoid 2011-10-31 12:33

2978 ms: constants replaced by vars, minor fixes
Seems to be faster.
http://pastebin.com/5dwTDk8q

Name: FrozenVoid 2011-10-31 13:02

2903ms precaching for empty frame generation, removed some vars
http://pastebin.com/TgYRwDaT

Name: FrozenVoid 2011-10-31 13:38

http://pastebin.com/ySXjrh5J
2473ms inner loop unrolled

Name: Anonymous 2011-10-31 13:48

Nobody cares, faggots

Name: FrozenVoid 2011-10-31 13:57

>>52
this is near-realtime video generation of full-screen quasicrystals in a browser.
It takes 15 seconds for a compiled -O2 haskell program running on six-core monster render a single crappy image of monochrome quasicrystal
my script would at 2.5 seconds completely load the entire 30-frame frameset of full screen, full color quasicrystals(and my version has better colors, since it fades/recycles colors with cool effect, rather then using a static multiply into an index).

Name: Anonymous 2011-10-31 13:57

>>51
Why don't you fucking hardcode the whole goddamn thing?

Name: FrozenVoid 2011-10-31 14:03

>>54
It would take longer to load. Precomputation has its limits.

Name: FrozenVoid 2011-10-31 14:38

Name: FrozenVoid 2011-10-31 15:58

http://pastebin.com/uweYKmZg
2032ms : cache locality improved, grouped ops(looks like batch processing)

Name: Anonymous 2011-10-31 16:00

You know /prog/ is shit when FV optimizing his JS is more interesting than the rest of the board.

Name: FrozenVoid 2011-10-31 16:01

>>57 has wrong colors: http://pastebin.com/Sp9fEnen fixed version

Name: FrozenVoid 2011-10-31 16:09

Name: Anonymous 2011-10-31 17:15

OVER 9KG OF VAGINA AND ANUS!

Name: Anonymous 2011-10-31 17:38

I'm curious as to why the lookup computations were considered slower. I've tried optimizing js animation code in the past with inconsistent results, especially when trying to move mults out of loops.

Name: Anonymous 2011-10-31 17:54

>>60
I won't be impressed until it runs at 1tP.

Name: FrozenVoid 2011-10-31 19:05

Lookup tables are justified when the: cost of OP > cost of lookup+storage
A lookup table for plain x*y multiply is likely to be useless(with exception of innermost loops), but lookup for x*y*z-v*y*x would reduce computational load significantly.
Division is usually replaced by muls to inverse, and inverse tables/consts can be created for common vars,much more useful in practice.
I dislike lookup tables personally, it is inelegant solution to algorithmic load,unlike simplifying higher level formula describing the algorithm.
Nevertheless, expert usage and testing can make lookup tables effective, especially when the table is generated dynamically in response to data(as in Acid code) simplifying the code into a chain of lookup tables.
>>63
I can hardcode most of the stuff, but this will cost with flexibility:
no zoom factor changes for example, no custom sin/cos table seeds,etc.

Name: Anonymous 2011-10-31 20:15

>>53
It's not cool, nobody cares

Name: Anonymous 2011-10-31 20:17

const zero=0;
const one=1
const two=2
const three=3
const four=4
const five=5
const six=6
const seven=7
const eight=8


Seriously?

Name: FrozenVoid 2011-10-31 21:25

>>66
I was testing how FF uses constants vs numbers in the inner loop,you can replace them if you want.

Name: FrozenVoid 2011-10-31 21:44

>>65
Its more cool than any screensaver i've seen.

Name: Anonymous 2011-10-31 21:56

>>67
So whats the result?

Name: FrozenVoid 2011-10-31 22:01

>>69
Nothing. Constants don't slow down the code much and don't speed it up.
I was searching for optimizations for every variable and its effect in the inner loop.

Name: Anonymous 2011-11-01 3:55

>>60

Uncaught SyntaxError: Unexpected identifier

var xcomcoss=xcoms.map(function(e) Math.cos(e))

how about coding things so they work in chrome

also it looks stretched diagonally in firefox with a black line unless the window is at very specific sizes

Name: Anonymous 2011-11-01 4:00

>>71
how about coding things so they work in chrome
Bad idea. Things that run well in chrome run poorly elsewhere. Just make your own version that only works in chrome.

Name: FrozenVoid 2011-11-01 4:19

http://pastebin.com/LmKpfZqb
Version which run at 10fps, without cache:1024frames without any memory cost
It is 2 times slower, but only use 30mb of ram vs nearly 1.2GB for fast version(30 frames*40mb).
>>71
The canvas is not stretched: it aligned to avoid clipping
If i used fullsize canvas it would clip(will have scroll bars and obscured parts) and will not have optimized aligned%8 loop

Name: FrozenVoid 2011-11-01 4:30

>>71
Array.map(function(e) func(e))  and Array.map(function(e){/
* code*
/})is a very common modern javascript idiom.
If google does not want to support it, its their lose.
You can rewrite it as loop with ~0.5ms faster execution time if you like.

Name: FrozenVoid 2011-11-01 4:36

.map/Math.cos will be replaced by faster code later, i'm more concerned with overall design now.

Name: Anonymous 2011-11-01 4:42

doesnt work in chromium

Name: Anonymous 2011-11-01 7:18

>>76
That's a feature.

Name: FrozenVoid 2011-11-01 7:52

http://pastebin.com/HKgRXBX2
Acid 5.9 :1952 ms per 30 frames
Cached version:
 - setTimeout replaced by loop, pre-computation loops merged(not optimized yet)
- frame display is now in separate function
- precomputation loops merged(not completely optimized, just merged)

Name: Anonymous 2011-11-01 8:31

>>74

defining a function without braces is not a common javascript idiom.

Name: FrozenVoid 2011-11-01 8:43

>>79
Its called short function syntax, used like
if(x)code;
but now with functions
function a(v) v*2
(return is ommited since the last expression is returned)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List