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

Pages: 1-4041-8081-120121-160161-200201-240241-280281-

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: Anonymous 2011-10-28 12:36

Name: Anonymous 2011-10-28 12:48

fuck off back to reddit

Name: Anonymous 2011-10-28 13:04

haskell is for faggots
lisp sucks dicks

Name: FrozenVoid 2011-10-29 2:04

http://pastebin.com/hAyVZ1Yk
branchless version of >>1, about 1s faster

Name: FrozenVoid 2011-10-29 2:50

>>2
Thats cute, but thirty times slower

Name: Anonymous 2011-10-29 3:27

>>6
Because the JavaScript one caches the frames after they're rendered first. The Haskell one doesn't.

Name: FrozenVoid 2011-10-29 5:04

>>7
Haskell(single threaded) renders each frame ~15 seconds, mine 0.5s (most recent is 0.43s)
15/0.5=30

Name: Anonymous 2011-10-29 5:08

GC is shit. You should be ashamed of yourself for not writing this in C.

Name: FrozenVoid 2011-10-29 5:18

>>9
There is no point, C can do it realtime, but you can't embed C in a webpage.

Name: Anonymous 2011-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: FrozenVoid 2011-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: Anonymous 2011-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.

Name: FrozenVoid 2011-10-29 6:03

>>13
The version which i wrote is 3-4 times faster than naive implementation from Haskell used by http://www.jasondavies.com/animated-quasicrystals/

Name: Anonymous 2011-10-29 6:08

>>14
So you didn't even write it all by yourself, you just improved the performance of another's work.

Name: FrozenVoid 2011-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.

Name: Anonymous 2011-10-29 6:46

-funroll-all-loops!

Name: FrozenVoid 2011-10-29 6:47

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: Anonymous 2011-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.

Name: Anonymous 2011-10-29 7:57

Good job FV.

Name: FrozenVoid 2011-10-29 11:06

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: Anonymous 2011-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.

Name: Anonymous 2011-10-29 11:54

>>22
dem dubs

Name: FrozenVoid 2011-10-29 11:58

http://pastebin.com/PH4VGt9u
8228ms  per 30 frames. new record

Name: FrozenVoid 2011-10-29 12:01

I'll rewrite Math.cos/sin calls to my version later, this is just a demo

Name: FrozenVoid 2011-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

Name: Anonymous 2011-10-29 13:10

Name: FrozenVoid 2011-10-29 13:26

http://pastebin.com/svrK76sT
7097ms (relocated inner loop mul vars to outer loop)

Name: Anonymous 2011-10-29 14:15

don't post

Name: FrozenVoid 2011-10-29 22:34

Name: Anonymous 2011-10-29 22:40

Still a useless gimmick.

Name: FrozenVoid 2011-10-29 22:57

>>31
If you don't appreciate programming just stop shitposting in my thread and get out of /prog/

Name: Anonymous 2011-10-30 0:26

I appreciate your javascript performance demo gimmick :]

Name: Anonymous 2011-10-30 0:46

Date.now() is better than (new Date().getTime())

Name: Anonymous 2011-10-30 0:53

also you should be posting these on jsperf maybe

Name: FrozenVoid 2011-10-30 2:23

http://pastebin.com/SBDutK45
5851ms: inner loop reduced to 2 multiplies and 1 add

Name: FrozenVoid 2011-10-30 13:51

http://pastebin.com/zduwQEiR
Refactored code 5835 ms

Name: FrozenVoid 2011-10-30 14:38

5572 ms : ternary removed
http://pastebin.com/wzYWG8wD

Name: Anonymous 2011-10-30 15:38

Why is this thread being bumped by invisible posts?

Name: Anonymous 2011-10-30 16:20

I could use some acid, man

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)

Name: Anonymous 2011-11-01 9:10

what a moron
var cos = Math.cos;

Name: FrozenVoid 2011-11-01 10:14

1593ms: pixels drawn as ints via lookup table.
http://pastebin.com/JEuL9v37

Name: FrozenVoid 2011-11-01 13:20

http://pastebin.com/wKe8cxW6
1332ms: new precomp code (fold product)

Name: Anonymous 2011-11-01 13:41

>>83
Inside the first loop, isn't it faster to do

for(i=0;i<frcount;i++){//replaces CreateImageData
cache[i]={width:w, height:h, ... };
wint[i]=Uint32Array(cache[i].data.buffer);
}

?

Name: FrozenVoid 2011-11-01 13:57

>>84
About 40ms slower.

Name: Anonymous 2011-11-01 14:12

not using pypy
enjoy your slow javascript, ``faggot''

Name: Anonymous 2011-11-01 14:46

>>84
mfw its 2011 and still using brackets on the same line
:|

Name: FrozenVoid 2011-11-01 14:47

>>86
You're welcome to write a faster version in Python.

Name: Anonymous 2011-11-01 15:09

>>86-87
Go back to /g/.

Name: FrozenVoid 2011-11-01 15:09

http://pastebin.com/dmjkeS8V
1294 ms : loop increment moved into indexes

Name: Anonymous 2011-11-01 15:32

>>89
mfw when someone write go back to/g/
:|

Name: Anonymous 2011-11-01 15:33

>>91
GB back to /g/.

Name: FrozenVoid 2011-11-01 16:06

http://pastebin.com/AnFmpwpC
1213 ms:  index|0, loop change to while

Name: Anonymous 2011-11-01 16:25

>>93
mfw when someone writes sage in the Email field
:|

>>92
mfw when someone tries to optimize js code
:|

>>93
mfw i post things
:|

Name: Anonymous 2011-11-01 16:28

mfw 000000 is someones ibank password
:|

mfw its the same password for all his accounts
:|

mfw i find out he has already filed for card fraud in one
of his inbox mails
:|

Name: Anonymous 2011-11-01 16:39

wants to use js because it is cross platform and runs everywhere with a browser
only works with firefox

why don't you try writing real javascript instead of vendor specific hax.

Name: Anonymous 2011-11-01 16:40

>>95
mfw someone posts ``mfw'' posts on /pro[spoiler/b/[/spoiler]
:|

Name: Anonymous 2011-11-01 17:07

>>96
fixed
| wants to use js because it is cross platform and runs everywhere with a browser
| only works with firefox
mfw
:|

Name: Anonymous 2011-11-01 17:25

>>94-98
Go back to /g/.

Name: Anonymous 2011-11-01 18:43

>>99
mfw I can't go ``back`` to /g/
:|

Name: Anonymous 2011-11-01 18:50

mfw i realized that everyone cool that was here
moved to /g/ and everyone from /g/ moved here
:(
mfw so long buddies
:)

Name: Anonymous 2011-11-01 18:55

>>101
mfw /prog/ is actually cooler now
no face

Name: Anonymous 2011-11-01 19:15

my face when theres noone left to talk
:|

Name: Anonymous 2011-11-01 19:39

>>100-103
Go back to /g/.

Name: Anonymous 2011-11-01 19:47

>>999-104
Go back to /g/.

my face when they have all gone back to /g/
:|

Name: Anonymous 2011-11-01 19:59

>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.
Actually, you have to use intensive JS shit to display APNG in half of the browsers: https://github.com/davidmz/apng-canvas

Name: CC D 2011-11-01 20:39

>>106
my face when webgl is not even mentioned
instead a gif solution is proposed
:|

Name: Anonymous 2011-11-01 21:26

>>106,107
back to /g/, faggots

Name: Anonymous 2011-11-01 21:34

>>105-108
Go back to /g/.

Name: CCD 2011-11-01 22:02

mfw people cant even go back to /g/
:|

Name: Anonymous 2011-11-01 22:09

>>1
my face when people try to optimize spaghetti js code
with no functions and a bazillion uniquely named
variables
:|

mfw they could just call couple webgl functions
:|

mfw /prog/ is not about programming anymore
but about people trying to sent other people back to /g/
:|

mfw
you need at least 1.21 Giga Watts to sent someone
back to /g/
:|

Name: Anonymous 2011-11-01 23:56

>>111
Nice trips ``category 5 fagstorm''

MFW you refuse to go back to /{b,g,jp}/

:((((

Name: FrozenVoid 2011-11-02 0:57

>>111
When webGL becomes a stable api(note "experimental-webgl" part) supported by all browsers, i'll consider it.
Last time i tried to runs WebGL half the shaders didn't run, another displayed white blobs randomly on my screen and FF used up all my memory

Name: Anonymous 2011-11-02 3:20

>>113
Because you can't program for shit.

Name: FrozenVoid 2011-11-02 3:25

>>114
I didn't write any shaders, i've tried to run
http://www.iquilezles.org/apps/shadertoy/

Name: Anonymous 2011-11-02 4:04

WebGL leads to security flaws.  I keep it disabled.

Name: Anonymous 2011-11-02 6:00

>>112
mfw when some kid tries to troll /prog/
:|

Name: Anonymous 2011-11-02 6:01

>>114
mfw some kid confuses programming with testing
:|

>>116
mfw some kid still thinks he's in /g/
so he plays it safe
:|

Name: Anonymous 2011-11-02 6:04

>>115
this didnt work for you?
how come?

Name: Anonymous 2011-11-02 6:04

Masturbate Early, Masturbate Often.

Name: Anonymous 2011-11-02 6:25

>>118
I'm okay with your use of mfw and `>implying, but at least put a little thought in your posts.

Name: Anonymous 2011-11-02 7:44

>>110-121
Go back to /g/.

Name: Anonymous 2011-11-02 10:15

>>122
go fuck a goat, autist

Name: FrozenVoid 2011-11-02 12:20

>>119
I'm using ATI Radeon 2100(onboard) (i don't intend to upgrade for modern 3-D games or something equally useless)

Name: Anonymous 2011-11-02 13:36

<--- check my dubz

Name: FrozenVoid 2011-11-02 14:03

Name: Anonymous 2011-11-02 14:27

you guys do realize however that you have to post
pc specs too right?

Name: Anonymous 2011-11-02 15:08

wtf i thought this was instruktion how to make asid

Name: h 2011-11-02 15:42

>>128
You will have to look that up on your own grasseater.

Name: FrozenVoid 2011-11-02 16:31

>>127
CPU:Athlon II 240     2.8 GHz     45nm SOI     2MB:L2Cache     socket AM3     65W TDP, Family 16 Model 6
Video:ATI Radeon 2100 onboard
OS:Windows XP sp2
Browser:Firefox 10.0a1 (2011-11-02)

Name: Anonymous 2011-11-02 21:18

>>130
OS:Windows XP sp2
shit quality

Name: FrozenVoid 2011-11-03 1:35

952ms : subsecond barrier broken with merged pixel fill hack
http://pastebin.com/d9X4q7VM

Name: FrozenVoid 2011-11-03 1:43

>>131
 i don't have to fight my OS everyday to use it. I don't have to resolve dependencies, hunt correct drivers or recompile kernels.
I just expect the system to be stable and behave as expected. I'm not a fan of MS but XP is excellent OS for casual use.
No Lunix distro does ever come close.

Name: Anonymous 2011-11-03 1:52

>>133
At the end of the day, you're still some FrozenVoid.

Name: HAXUS THE WISE 2011-11-03 2:06

>>133
XP is made of equal parts FAIL and AIDES. Enjoy that giant redmond dick up your ass, kid.

Name: FrozenVoid 2011-11-03 2:06

>>134
At the end of the day, you're still some Anonymous, while i retain my own personality.

Name: FrozenVoid 2011-11-03 2:09

>>135
You know, you should install LoseThos, the only OS not ruined by big corporations.

Name: FrozenVoid 2011-11-03 2:11

>>137
That is not me.

Name: FrozenVoid 2011-11-03 2:14

>>136,138
Stop impersonating me.

Name: FrozenVoid 2011-11-03 2:14

>>138
Identity!=Personality. You can pretend to be FrozenVoid but you lack personality, just another anonymous trying to mock me.

Name: Anonymous 2011-11-03 2:14

>>137, 138 Where's the trip to prove it? Mr. False FV? Back your claims up or be called out on your Bullshit.

Name: FrozenVoid 2011-11-03 2:17

>>139,140
It really doesn't matter if you post with my name. I am still me.

Name: Anonymous 2011-11-03 2:19

>>141
Will you get upset at tripcode use again?

Name: FrozenVoid 2011-11-03 2:19

Then who was phone?

Name: FrozenVoid !frozEn/KIg 2011-11-03 2:22

Okay due popular demand i switch to tripcode use again. With secure tripcode so it won't be hacked.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 2:23

Test~

Name: FrozenVoid !frozEn/KIg 2011-11-03 2:23

>>146
This will be the new tripcode

Name: Anonymous 2011-11-03 2:26

>>145
I think popular demand was more something along the lines of "GTFO".

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 2:29

>>148
If you want me to "GTFO" why you impersonate and emulate me?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 2:39

http://pastebin.com/zqQNB8HN
892ms: variable fix

Name: Anonymous 2011-11-03 2:47

>>150
Awesome code. Great size. Looks concise. Efficient. Elegant. Keep us all posted on your continued progress with any new code factoring or compiler optimization. Show us what you got man. Wanna see how freakin' expressive, efficient, concise and elegant you can get. Thanks for the motivation.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 2:53

>>151
I was originally motivated by slow render on jasons site, it was about 2 minutes to render a tiny rectangle.
I opened the code in my Notepad2 and noticed it used closures and complex functions in the inner loop, so i refactored it and started optimizing.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 3:16

http://pastebin.com/4rNEs0Wg
871ms  lookup replaced by Math.abs in the inner loop

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 3:39

861ms :merged even/odd to abs arguments.
http://pastebin.com/ax1WjEVh

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 4:03

http://pastebin.com/yDCh0WJS
848ms switched to increment for Xindex

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 5:00

http://pastebin.com/CeR6WWtQ
830ms faster unroll

Name: Anonymous 2011-11-03 6:28

'When webGL becomes a stable api(note "experimental-webgl" part) supported by all browsers, i'll consider it.'

yet webgl works in more browsers than your code, which only works with newer versions of firefox, and not only that, the window has to be a certain size!

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 6:52

>>157
>yet webgl works in more browsers than your code
Not in mine. WebGL is newer and less supported than canvas, require specific hardware(have you ever upgraded your video card to View a  Webpage?)
>which only works with newer versions of firefox
It use ArrayBuffer and PutImageData nothing complex
>the window has to be a certain size!
 its so hard to click maximize window.

Name: Anonymous 2011-11-03 8:15

http://i.imgur.com/RrxMc.jpg

here's what it looks like in my maximized firefox.

it's stretchfucked unless i find the magic window ratio that makes it work

and it's not the arraybuffers that make it not work in other browsers, it's the function syntax

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 9:56

>>159
http://pastebin.com/1nYSxAZf
Acid 7 with CSS fix for canvas

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 10:01

Apparently does not work. Canvas ruins 16:9 ratio

Name: Anonymous 2011-11-03 10:09

why are you wasting so much time optimizing
a gimmick effect that is pretty much unwatchable after
couple seconds and dont optimize something else
and if one of your answers is
1)because i can ,well there better things to optimize
2)like what , i dont know work on something interactive
you strike me as a smart person dont confine yourself
with just this

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 10:10

Name: Anonymous 2011-11-03 10:12

FrozenVoid, why don't you make a canvas-based danmaku game?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 10:14

>>162
Its called recreational programming or hacking: I'm not a code monkey assigned to optimize indian bloatware or open source developer striving to develop a "product".

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 10:16

>>164
I don't liek twitch games.

Name: Anonymous 2011-11-03 10:22

>>165
Then hack a bit and optimize something useful, such as Hurd. You don't have to try to finish it, just improve it.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 10:27

>>167
I don't "join open source projects".
I could take the code, optimize it and post to pastebin, but i will not "distribute" or "support" anything
And i certainly don't want to optimize GNU/Turd ancient code.

Name: Anonymous 2011-11-03 10:29

>>168
Why not?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 10:30

Besides i have my own OS project, though its not a priority right now.
http://www.reddit.com/r/FrozenOS/

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 10:32

>>169
In open source terms i will "fork the code", and i will not improve your code i will improve my code.

Name: Anonymous 2011-11-03 10:34

>>171
Okay, do that.
As long as your code is also published under a free license, the original project can benefit from it. Also, your fork may actually be better than the original. Both are Good.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 10:40

>>172
>your code is also published
I'd use creative commons for my code, but since i won't support it i won't "publish"
A fork quality is dependent on effort spent into it.
I can optimize a small 10kb script all day long with minimum effort but OS development is far more resource intensive.
LoseThos author spent 9 years to write a VGA-only Multiuser DOS clone.

Name: Anonymous 2011-11-03 10:49

>>173
Okay then, suit yourself.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 10:57

If you consider effort/reward ratio for OS development(very low), its useless for hacking unless the OS itself is very small.
OS performance is not a primary goal in most cases: usability/security/design always trumps such concerns as absolute algorithmic speed(i.e. there is no point optimizing it for speed,unlike an abstract algorithm).
The idea that developing an OS is serious, productive and respectable work while coding a script is useless gimmick is like comparing
people working at orchestra and people playing a violin at home.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 11:07

If you can find an algorithm(source code in JavaScript or C(i dislike debugging complex C code, but i like to write low-level bithacks which require C)) where
1.Performance is ultimate concern
2.Algorithm can be tested many time per hour
3.Its provides a useful effect,feature or some other result which depends on performance.
I'll copy it to my script folder and optimize it,
if it works better, i'll post it on /prog/ and my subreddit.

Name: Anonymous 2011-11-03 11:28

>>176
>Optimizing algorithms instead of software
Are you a Computer Scientist?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 11:53

>>177
I suppose I am in some form a computer scientist, but my field of "science" is more about hacking algorithms and far removed from writing papers or proving theorems(i.e. i'm more concerned about algos as code, rather then their theoretical properties)
When i use a sine formula, i use it like a tool, i don't intend to comprehend it as long as it works(unlike a computer scientist who would describe its algorithmic complexity, minimal running time or some arcane abstract proof from algorithmic theory)

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-03 12:56

I can see the gulf between theoretical computer science and algorithm hacking as
1. the first is all about the purity of form, the algorithm has to be expressed as succinctly as possible(lambda calculus, function combinators)
2. the second is all about the purity of essence, stripping the code from internal cruft and removing inefficiency, the algorithm external look is irrelevant.

Name: Anonymous 2011-11-03 12:58

>>179
So you say computer scientists are Protoss and hackers are Zerg?

Name: Anonymous 2011-11-03 13:04

>>180
Are then programmers Terran?

Name: Anonymous 2011-11-03 15:01

>>181
Are then progamers Terran?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 10:16

http://pastebin.com/zAvRA9Tp
Acid 7.5 - Reduced memory usage and fixes in css for render aspects

Name: Anonymous 2011-11-04 11:36

put some decent textures render with transparency
and u've got yourself water effect

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 12:10

http://pastebin.com/V8ebcddY
A version with per-frame pallette index changes

Name: Anonymous 2011-11-04 13:40

nobody cares

Name: Anonymous 2011-11-04 13:58

the code is a huge mess someone should put some comments
if it to be redistributed

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 14:08

>>187
>is a huge mess
Pretty clear to me. it precomputes a chain of tables, saves indexes to wint array and displays them frame by frame.
New version is more CPU-intensive but uses 4 times less memory(since it stores 8 bits per pixel(index)).

Name: Anonymous 2011-11-04 14:10

its pretty clear to you that spent so much time with it
if you want someone to immediately get a grip
comments are a necessity especially
when the code is a mess

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 14:10

Name: Anonymous 2011-11-04 14:23

>>187
Those are great ideas. Popst tha shit up when you are done doing it. DOn't go trying to get us to do that for you. We aintcha niggas.

Name: Anonymous 2011-11-04 14:34

ok ok

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 14:40

Name: Anonymous 2011-11-04 14:51

>>190
How on earth that code has been mutated into >>193

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 15:16

>>194
>I am to lazy to read the entire thread, please post an outline

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 17:11

http://pastebin.com/61361hxi
Better dispframe() performance with unrolled convert loop.
render speed is the same:
120frames at 3360ms
30 frames at 902 ms

Name: Anonymous 2011-11-04 17:24

>xsum*((((xsum>=0)|0)<<1)-1)
What the fuck?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 17:35

>>197
A way to calculate absolute value. Its just an alternative to express x*( x>0?1:-1) without the ternary.
Math.abs is faster(due fact JS converts doubles to int32 each time a bitwise operation is required and back.)

Name: Anonymous 2011-11-04 17:42

>>197
Wouldn't something like xsum - 2 * xsum * (xsum<0) be simpler?

Name: Anonymous 2011-11-04 18:18

(xsum>=0)|0
what is the point of this?

Name: Anonymous 2011-11-04 18:37


           xsum >= 0                   // true or false
          (xsum >= 0) | 0              // 0 or 1
        (((xsum >= 0) | 0) << 1)       // 0 or 2
       ((((xsum >= 0) | 0) << 1) - 1)  // 1 or -1
xsum * ((((xsum >= 0) | 0) << 1) - 1)  // xsum or -xsum


If xsum is non-negative, the expression evaluates to xsum.  If it is negative, it evaluates to -xsum, which would be a positive number.  That's a really ignorant way to do abs(xsum).

Name: Anonymous 2011-11-04 18:43

>>201
true or false
damn, I always forget how stupid javascript is. calling 1/0 something else and after that applying a stupid operator ( OR ing with 0) to "convert" it 1/0

and people still trying to optimize it

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 22:05

>>197
That requires 2 multiplies instead of 1. >>202 its from C code
see http://codepad.org/nfOfmEqA

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 22:11

|0) is used to force JS to convert to int32, it can be ommited from both examples and it will run too.
  xsum*(((xsum>0)<<1)-1)
one multiply one sub one shift one compare. In C code there are faster bithacks to get abs value, like  (x ^ (x >> 31)) - (x >> 31) for ints
but this works for anything and not arch-specific.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 22:34

In general you avoid multiplies in loops.
There more complex an OP is more cycles it consumes. Simpler opcodes yield faster code.
Using shift/add is usually a 1-cycle affair.

Name: Anonymous 2011-11-05 0:09

fuck off, FVI

Name: Anonymous 2011-11-05 5:47

>>204
Why not do >>199? Also, are you sure that, in JavaScript, shifting is actually faster that multiplication?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 6:01

>>207
I use Math.abs in all code now.
There couple of bithacks which suppose to be faster(like x[a>0]) but due to overhead of array access and JS bitwise operation conversion its better just calling Math.abs which gets inlined anyway.

Name: Anonymous 2011-11-05 6:05

>>208
How exactly does Math.abs work? Because, if it's the same as in Java's Math class, then it just does a<0?-a:a.
Also, how do you get it inlined? JS methods are egregiously slow.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 6:08

>>209
JägerMonkey

JägerMonkey is an additional optimization to the engine in Firefox 4. It improves speed in cases where TraceMonkey optimizations fail to improve performance.[7][8]

The most publicized optimization in JägerMonkey is "method-based JIT" (that compiles code one method at a time) using inline threading (see [9]) and implements PICs, but there were multiple other optimizations implemented for Firefox 4.[10] To implement method JIT, Mozilla reused the assembler from Nitro, WebKit's JavaScript engine.[8]

The difference between TraceMonkey and JägerMonkey JIT techniques and the need for both was explained in a hacks.mozilla.org article. A more in-depth explanation of the technical details was provided by Chris Leary, one of SpiderMonkey developers, in a blog post. More technical information can be found in other developer's blogs: dvander, dmandelin.

Name: Anonymous 2011-11-05 6:10

>>210
Okay, nice.
Still, what exactly does Math.abs do?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 6:14

fhttp://en.wikipedia.org/wiki/X86_instruction_listings#Original_8087_instructions
FABS Absolute value of float.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 6:30

>>211
it depends on code actually. Sometimes it just an sign removal to normalize a formula sometimes its a switch to positive(backwards to NEG)
In this the negative indexes for pallette get converted to unsigned positive bytes from -1 to 1 into 0 to 255
 d1=(abs(temp1+(temp1&1)-rep1)*maxcolor)
d2=(abs(temp2+(temp2&1)-rep2)*maxcolor)
d3=(abs(temp3+(temp3&1)-rep3)*maxcolor)
d4=(abs(temp4+(temp4&1)-rep4)*maxcolor)
d5=(abs(temp5+(temp5&1)-rep5)*maxcolor)
d6=(abs(temp6+(temp6&1)-rep6)*maxcolor)
d7=(abs(temp7+(temp7&1)-rep7)*maxcolor)
d8=(abs(temp8+(temp8&1)-rep8)*maxcolor)

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 6:34

a value of Abs(-0.345)* maxcolor is  0.345 * 255  which is  87.975|0 which is 87th color from pallette

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 6:36

I use to have da[-maxcolor,maxcolor] with temp1&1 as selector but array access was slower than Math.abs(Firefox 10 here)

Name: Anonymous 2011-11-05 6:37

>>213
No, I meant what's the source of JavaScript's Math.abs method, how does it get get the absolute value? Bit operations? Branching?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 6:44

>>216
I have no idea, it depends on browser,JS engine optimizations, but in Firefox 10 its faster than ternary x?x:-x by a factor of 2-4.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 7:01

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 7:08

If its faster than ternary there 2 options:
1.they can use Fabs(1 cycle opcode:fastest, though requiring this asm intruction)
2.they use a bithack like mine inlined(unlikely, will be slower in most cases since it more opcodes)
3.They use a ternary, which is impossible since manually inlined ternary is 4 times slower.
I don't see any other options, and since >>218 uses Fabs to emit the end code(Clang is latest Mozilla toy for compiling firefox faster)
http://blog.mozilla.com/respindola/2011/05/06/firefox-builds-with-clang/

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 7:55

after browsing the internals of Mozilla Aurora it comes to this:
MATH_BUILTIN_1(js_math_abs, fabs)
JSBool
js_math_abs(JSContext *cx, uintN argc, Value *vp)
{
    jsdouble x, z;

    if (argc == 0) {
        vp->setDouble(js_NaN);
        return JS_TRUE;
    }
    if (!ValueToNumber(cx, vp[2], &x))
        return JS_FALSE;
    z = fabs(x);//<-- C fabs compiled to FABS on x86
    vp->setNumber(z);
    return JS_TRUE;
}

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 8:01

The file is named jsmath.cpp
 http://pastebin.com/4ev1Las5

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 8:11

Apparently FF caches cosines too..That explains why my optimized cos was on the same order of magnitude speed.
static JSBool
math_cos(JSContext *cx, uintN argc, Value *vp)
{
    jsdouble x, z;

    if (argc == 0) {
        vp->setDouble(js_NaN);
        return JS_TRUE;
    }
    if (!ValueToNumber(cx, vp[2], &x))
        return JS_FALSE;
    MathCache *mathCache = GetMathCache(cx);
    if (!mathCache)
        return JS_FALSE;
    z = mathCache->lookup(cos, x);
    vp->setDouble(z);
    return JS_TRUE;
}

Name: cheapbagshopping 2011-11-05 8:12

Thank you very much.Waiting for update.

Name: Anonymous 2011-11-05 8:15

>>223 --penisenhanced!

Name: Anonymous 2011-11-05 10:08

What about xsum*(1-((xsum<0)<<1))

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 10:37

>>225
Math.abs is C fabs(double) which compiles to FABS which is 1 cycle in all modern processors
xsum*(1-((xsum<0)<<1)) is at least 5 cycles and JS will insist on converting doubles to Int32 to use bitwise math(shifts).
There is no point optimizing it when Firefox uses asm code inlined for your methods.
x* ((((x >= 0)) << 1) - 1) is equivalent to xsum*(1-((xsum<0)<<1)) as    1 - 2:0 and 2:0 -1

Name: Anonymous 2011-11-05 10:46

>>226
It does not use bit shift on double, it is on boolean.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 10:53

>>227
 a double type is considered a universal in javascript. It does not matter if intermediates are int32, it int32 only at the point of calculations)
xsum=-2.02
xsum*(1-((xsum<0)<<1)) becomes:
xsum<0  = true
true<<1 =int32 (true:1)<<1= 2
1-2=-1
*=-1(double)-> -1.0000000 (converted to double)
xsum*-1.0000000

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 10:55

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 11:02

for fun try entering 4-3.001 at error console.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 11:05

4-4.001 = -0.001000000000000334

Name: Anonymous 2011-11-05 11:10

>>231
LOL SO FUNNY XD

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 11:12

http://www.hunlock.com/blogs/The_Complete_Javascript_Number_Reference
Precision

All numbers in Javascript are 64bit (8 bytes) floating point numbers which yields an effective range of 5e-324 (negative) to 1.7976931348623157e+308 (positive) at the time this article was written (this may eventually change to 128 bits in the future as 64 bit processors become commonplace and the ECMA standards evolve).

Integers are considered reliable (numbers without a period or exponent notation) to 15 digits (9e15) [1]. Floating point numbers are considered only as reliable as possible and no more! This is an especially important concept to understand for currency manipulation as 0.06 + 0.01 resolves to 0.06999999999999999 instead of 0.07.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 11:16

Bitwise Operators

Bitwise operations are a bit of a hack in Javascript. Since all numbers in Javascript are floating point, and bitwise operators only work on integers, Javascript does a little behind the scenes magic to make it appear bitwise operations are being applied to a 32bit signed integer.

Specifically, Javascript takes the number you are working on and takes the integer portion of the number. It then converts the integer to the most number of bits that number represents, up to 31 bits (1 bit for the sign). So 0 would create a two bit number (1 for the sign, and 1 bit for 0), likewise 1 would create two bits. 2 would create a 3 bit number, 4 would create a 4 bit number, etc…

It's important to realize that you're not guaranteed a 32bit number, for instance running not on zero should, in theory, convert 0 to 4,294,967,295, instead it will return -1 for two reasons, the first being that all numbers are signed in Javascript so "not" always reverses the sign, and second Javascript couldn't make more than one bit from the number zero and not zero becomes one. Therefore ~0=-1.

So bitwise signs in Javascript are up to 32 bits.

Operator    Description    Notes
&    AND    1&1=1,1&0=0
|    OR    1|0=1, 0|0=0
^    XOR    1^1=0, 1^0=1
~    NOT    (Unary) ~1=0, ~0=-1
<<    Shift Left    1<<2=4 -- shift 1, 2 bits left
>>    Shift Right    4>>2=1 -- shift 4, 2 bits right (*)
>>>    Shift Right    4>>>2=1 -- shift 4, 2 bits right (*)

(*) When shifting right, double greater-thans (>>) will fill the new bits to the far left as 1s if the number was negative and zero if the number was positive. tripple greater-thans (>>>) is the same as double greater-thans but the fill bit will always be zero so the sign of the original number is not preserved and the result is always positive.

With the exception of the bitwise NOT operator (~), all operators can be expressed as (operator)= when working with the same number as the variable.

   x = x&5;    // is the same as x &= 5;
   x = x|5;    // is the same as x |= 5;
   x = x^5;    // is the same as x ^= 5;
   x = x<<5;   // is the same as x <<= 5;
   x = x>>5;   // is the same as x >>= 5;
   x = x>>>5;  // is the same as x >>>= 5;

One of the most common mistakes in Javascript is to use a bitwise operator in the place of a logical operator. For instance comparing two variables is expressed with the logical operator (&&), using a single & instead of a double && can yield unintended results. To avoid confusion you should always wrap bitwise operations in parenthesis to ensure it is not considered a logical evaluation!

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 11:23

I'm waiting when JS will get native Int32 type(not typed arrays, an integer from C) and this behind the scenes conversion will cease.
I can't write bithacks and watch them get stalled converting integers represented as doubles to integers and back to doubles.

Name: Anonymous 2011-11-05 11:34

Why do you keep calling bitwise operations "bithacks"?

Name: Anonymous 2011-11-05 11:37

>>236
It's typical of users of toy languages.

Name: Anonymous 2011-11-05 11:38

>>235
Won't happen. If you want that, JavaScript is not the language for you.

Name: Anonymous 2011-11-05 11:42

I'm waiting when JS will disappear into oblivion.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 11:42

>>236
Not all bitwise operations are bithacks. A bithack is a low-level trick which replaces something complex with a series of low-latency opcodes.
A xsum*((((xsum>=0)|0)<<1)-1) is bithack in sense it replaces a "complex" function call for Math.abs(its externally complex, but in reality is inlined to fabs(x)) with several OP codes which do not stall the pipeline.
A ternary xsum=xsum>0?xsum:-xsum introduces a branch which stalls the pipepine and if mispredicted will lose many cycles while the above codes suffers no penalty, though it takes longer then calling a specific opcode for this operation in ASM(whic fabs reduces to)

Name: Anonymous 2011-11-05 11:50

yep but i really stopped using bithacks
main reason the code becomes unreadable
but given the state of the current code
doesnt matter really

Name: Anonymous 2011-11-05 11:53

>>240
A bithack is a low-level trick which replaces something complex with a series of low-latency opcodes
nope, they are still bitwise operations.
(xsum>=0)[b]|[/b]0
another reason why JS is shit. You are just making an unnecessary operation. it is Java's fault because if it does not have a proper type conversion. (or proper types at all)
(xsum>=0)|0)[b]<<[/b]1
holy shit, he replaced *2 with <<1. Stop the presses, we have a second Einstein here.
xsum[b]*[/b]((((xsum>=0)|0)<<1)[b]-[/b]1)
these are not bit wise operations

so you have 2 bitwise operations in your "bithack". one simply replaces *2 other is used to covert something into integer.

also I wonder how many cycles xsum=xsum>0?xsum:-xsum losts in a branch prediction. Does it really justify an addition, bitshift and a multiplication operation.

seriosuly, if you think bitwise operations are cool and into "bithack", go play with C and do something like this
http://codepad.org/d2C0BhOB

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 11:56

Actually i'm set on rewriting the code in C.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 11:56

>>242
Try replacing Math.abs in my script with ternaries.

Name: Anonymous 2011-11-05 12:13

>>242
Java's fault
You mean JavaScript.

Name: Anonymous 2011-11-05 12:17

>>244
I don't do javascript but tested it in C.
http://codepad.org/M7myWRnr
results are 25622 clocks for tenary and 30587 clocks for your bithax.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 12:42

>>242
I don't pretend to be a genius. Its a "hacking for fun" stuff.
I'll use as many exotic and quirky ways to program as i want as long as it useful for me.
You can laugh that i spend time on some "bithacks" but i'm exploring various algorithms and their simplified forms to my leisure.
JavaScript is very good for prototyping the "abstract program"(like e.g.LISP), only when the stage of micro-optimization is reached the flaws of internals are exposed.
>>246
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define LEN 10000
inline unsigned long long rdtsc(){__asm{RDTSC}}
void main(){
  int i, j, z;
  unsigned long long c1, c2;
    int arr[LEN];
    for(i=0; i<LEN; i++) arr[i] =rand()%10000-5000;
 
  //with branch
 c1 = rdtsc();
 for(j=0;j<LEN;j++) z = arr[j]>0?arr[j]:-arr[j];   
 
 c2 = rdtsc();
  printf("Cycles spent:%llu\n", c2-c1);
 
  //bithax
  c1 = rdtsc();
 for(j=0;j<LEN;j++) z =arr[j]*(((arr[j]>=0)<<1)-1);   
   c2 = rdtsc();
 printf("Cycles spent:%llu\n", c2-c1);

}
 result:

C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:30108
Cycles spent:30109

Name: Anonymous 2011-11-05 12:47


>>247
you removed |0.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 12:49

>>248
Its C not JavaScript |0 is forcing javaScript to convert number to int before a calculation starts, and not in the middle of it

Name: Anonymous 2011-11-05 12:51

>>249
yeah but we were testing if your algorithm beats branch tests or not. surely you can find a better algorithm for C

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 12:54

Okay, you'll be mad.
C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:30109  <- ternary
Cycles spent:30087 < with |0

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 12:55

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define LEN 10000
inline unsigned long long rdtsc(){__asm{RDTSC}}
void main(){
  int i, j, z;
  unsigned long long c1, c2;
    int arr[LEN];
    for(i=0; i<LEN; i++) arr[i] =rand()%10000-5000;
 
  //with branch
 c1 = rdtsc();
 for(j=0;j<LEN;j++) z = arr[j]>0?arr[j]:-arr[j];   
 
 c2 = rdtsc();
  printf("Cycles spent:%llu\n", c2-c1);
 
  //bithax
  c1 = rdtsc();
 for(j=0;j<LEN;j++) z =arr[j]*((((arr[j]>=0)|0)<<1)-1);   
   c2 = rdtsc();
 printf("Cycles spent:%llu\n", c2-c1);

}

Name: Anonymous 2011-11-05 12:56

>>251
lol, why should I be.

are you sure you disabled optimizations? since it is same I am assuming |0 is optimized out

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 12:58

C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:203969
Cycles spent:184612
Without optimizations

Name: Anonymous 2011-11-05 13:00

>>254
Damn, we should insert |0 everywhere the. Since it costs negative clock cycles.

or your compiler still optimizes it out

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 13:02


C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
z = arr[j]>0?arr[j]:-arr[j];    Cycles spent:204355
 z = ((-arr[j])<<(arr[j]<0))+((arr[j])<<(arr[j]>0)); Cycles spent:186485

code (i expected adds to be faster):
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define LEN 10000
inline unsigned long long rdtsc(){__asm{RDTSC}}
void main(){
  int i, j, z;
  unsigned long long c1, c2;
    int arr[LEN];
    for(i=0; i<LEN; i++) arr[i] =rand()%10000-5000;
 
  //with branch
 c1 = rdtsc();
 for(j=0;j<LEN;j++) z = arr[j]>0?arr[j]:-arr[j];   
 
 c2 = rdtsc();
  printf("z = arr[j]>0?arr[j]:-arr[j];    Cycles spent:%llu\n", c2-c1);
 
  //bithax
  c1 = rdtsc();
 for(j=0;j<LEN;j++) z =((-arr[j])<<(arr[j]<0))+((arr[j])<<(arr[j]>0));       
   c2 = rdtsc();
 printf(" z = ((-arr[j])<<(arr[j]<0))+((arr[j])<<(arr[j]>0)); Cycles spent:%llu\n", c2-c1);

}

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 13:05

>>255
Nope it should cost more clock cycles but it does something to my CPU and it makes it complete faster.
Maybe it ensures some pipeline integrity or forces some intermediates to be present in registers.
; Disassembly of file: abs.obj
; Sat Nov 05 19:49:12 2011
; Mode: 32 bits
; Syntax: MASM/ML
; Instruction set: Pentium

.586
.model flat

public _main
public _rdtsc                                           ; Note: Communal. Not supported by MASM

extern _rand: near
extern _printf: near
extern _rdtsc: near
extern __acrtused_con: byte

FLAT    GROUP


_TEXT   SEGMENT DWORD PUBLIC 'CODE'                     ; section number 1

_main   PROC NEAR
        push    ebp                                     ; 0000 _ 55
        mov     ebp, esp                                ; 0001 _ 8B. EC
        mov     edx, 9                                  ; 0003 _ BA, 00000009
?_001:  sub     esp, 4096                               ; 0008 _ 81. EC, 00001000
        test    dword ptr [esp], esp                    ; 000E _ 85. 24 24
        dec     edx                                     ; 0011 _ 4A
        jnz     ?_001                                   ; 0012 _ 75, F4
        sub     esp, 3160                               ; 0014 _ 81. EC, 00000C58
        push    ebx                                     ; 001A _ 53
        push    esi                                     ; 001B _ 56
        push    edi                                     ; 001C _ 57
        mov     dword ptr [ebp-9C50H], 0                ; 001D _ C7. 85, FFFF63B0, 00000000
?_002:  cmp     dword ptr [ebp-9C50H], 10000            ; 0027 _ 81. BD, FFFF63B0, 00002710
        jge     ?_003                                   ; 0031 _ 7D, 28
        call    _rand                                   ; 0033 _ E8, 00000000(rel)
        mov     ecx, 10000                              ; 0038 _ B9, 00002710
        cdq                                             ; 003D _ 99
        idiv    ecx                                     ; 003E _ F7. F9
        add     edx, -5000                              ; 0040 _ 81. C2, FFFFEC78
        mov     eax, dword ptr [ebp-9C50H]              ; 0046 _ 8B. 85, FFFF63B0
        mov     dword ptr [ebp+eax*4-9C40H], edx        ; 004C _ 89. 94 85, FFFF63C0
        inc     dword ptr [ebp-9C50H]                   ; 0053 _ FF. 85, FFFF63B0
        jmp     ?_002                                   ; 0059 _ EB, CC

?_003:  call    _rdtsc                                  ; 005B _ E8, 00000000(rel)
        mov     dword ptr [ebp-9C48H], eax              ; 0060 _ 89. 85, FFFF63B8
        mov     dword ptr [ebp-9C44H], edx              ; 0066 _ 89. 95, FFFF63BC
        mov     dword ptr [ebp-9C4CH], 0                ; 006C _ C7. 85, FFFF63B4, 00000000
?_004:  cmp     dword ptr [ebp-9C4CH], 10000            ; 0076 _ 81. BD, FFFF63B4, 00002710
        jge     ?_007                                   ; 0080 _ 7D, 1D
        mov     edx, dword ptr [ebp-9C4CH]              ; 0082 _ 8B. 95, FFFF63B4
        mov     ebx, dword ptr [ebp+edx*4-9C40H]        ; 0088 _ 8B. 9C 95, FFFF63C0
        test    ebx, ebx                                ; 008F _ 85. DB
        jle     ?_005                                   ; 0091 _ 7E, 02
        jmp     ?_006                                   ; 0093 _ EB, 02

?_005:  neg     ebx                                     ; 0095 _ F7. DB
?_006:  inc     dword ptr [ebp-9C4CH]                   ; 0097 _ FF. 85, FFFF63B4
        jmp     ?_004                                   ; 009D _ EB, D7

?_007:  call    _rdtsc                                  ; 009F _ E8, 00000000(rel)
        sub     eax, dword ptr [ebp-9C48H]              ; 00A4 _ 2B. 85, FFFF63B8
        sbb     edx, dword ptr [ebp-9C44H]              ; 00AA _ 1B. 95, FFFF63BC
        push    edx                                     ; 00B0 _ 52
        push    eax                                     ; 00B1 _ 50
        push    offset FLAT:?_010                       ; 00B2 _ 68, 00000000(segrel)
        call    _printf                                 ; 00B7 _ E8, 00000000(rel)
        call    _rdtsc                                  ; 00BC _ E8, 00000000(rel)
        mov     dword ptr [ebp-9C48H], eax              ; 00C1 _ 89. 85, FFFF63B8
        mov     dword ptr [ebp-9C44H], edx              ; 00C7 _ 89. 95, FFFF63BC
        add     esp, 12                                 ; 00CD _ 83. C4, 0C
        mov     dword ptr [ebp-9C4CH], 0                ; 00D0 _ C7. 85, FFFF63B4, 00000000
?_008:  cmp     dword ptr [ebp-9C4CH], 10000            ; 00DA _ 81. BD, FFFF63B4, 00002710
        jge     ?_009                                   ; 00E4 _ 7D, 3C
        mov     esi, dword ptr [ebp-9C4CH]              ; 00E6 _ 8B. B5, FFFF63B4
        mov     edi, dword ptr [ebp+esi*4-9C40H]        ; 00EC _ 8B. BC B5, FFFF63C0
        mov     dword ptr [ebp-9C54H], edi              ; 00F3 _ 89. BD, FFFF63AC
        neg     edi                                     ; 00F9 _ F7. DF
        mov     ecx, dword ptr [ebp-9C54H]              ; 00FB _ 8B. 8D, FFFF63AC
        shr     ecx, 31                                 ; 0101 _ C1. E9, 1F
        shl     edi, cl                                 ; 0104 _ D3. E7
        mov     eax, dword ptr [ebp-9C54H]              ; 0106 _ 8B. 85, FFFF63AC
        mov     ecx, eax                                ; 010C _ 89. C1
        neg     ecx                                     ; 010E _ F7. D9
        sbb     ecx, 0                                  ; 0110 _ 83. D9, 00
        shr     ecx, 31                                 ; 0113 _ C1. E9, 1F
        shl     eax, cl                                 ; 0116 _ D3. E0
        add     edi, eax                                ; 0118 _ 03. F8
        inc     dword ptr [ebp-9C4CH]                   ; 011A _ FF. 85, FFFF63B4
        jmp     ?_008                                   ; 0120 _ EB, B8

?_009:  call    _rdtsc                                  ; 0122 _ E8, 00000000(rel)
        sub     eax, dword ptr [ebp-9C48H]              ; 0127 _ 2B. 85, FFFF63B8
        sbb     edx, dword ptr [ebp-9C44H]              ; 012D _ 1B. 95, FFFF63BC
        push    edx                                     ; 0133 _ 52
        push    eax                                     ; 0134 _ 50
        push    offset FLAT:?_011                       ; 0135 _ 68, 00000034(segrel)
        call    _printf                                 ; 013A _ E8, 00000000(rel)
        xor     eax, eax                                ; 013F _ 31. C0
        add     esp, 12                                 ; 0141 _ 83. C4, 0C
        pop     edi                                     ; 0144 _ 5F
        pop     esi                                     ; 0145 _ 5E
        pop     ebx                                     ; 0146 _ 5B
        leave                                           ; 0147 _ C9
        ret                                             ; 0148 _ C3
_main   ENDP

_TEXT   ENDS

_DATA   SEGMENT DWORD PUBLIC 'DATA'                     ; section number 2

?_010   label byte
        db 7AH, 20H, 3DH, 20H, 61H, 72H, 72H, 5BH       ; 0000 _ z = arr[
        db 6AH, 5DH, 3EH, 30H, 3FH, 61H, 72H, 72H       ; 0008 _ j]>0?arr
        db 5BH, 6AH, 5DH, 3AH, 2DH, 61H, 72H, 72H       ; 0010 _ [j]:-arr
        db 5BH, 6AH, 5DH, 3BH, 20H, 20H, 20H, 20H       ; 0018 _ [j];   
        db 43H, 79H, 63H, 6CH, 65H, 73H, 20H, 73H       ; 0020 _ Cycles s
        db 70H, 65H, 6EH, 74H, 3AH, 25H, 6CH, 6CH       ; 0028 _ pent:%ll
        db 75H, 0AH, 00H, 00H                           ; 0030 _ u...

?_011   label byte
        db 20H, 7AH, 20H, 3DH, 20H, 28H, 28H, 2DH       ; 0034 _  z = ((-
        db 61H, 72H, 72H, 5BH, 6AH, 5DH, 29H, 3CH       ; 003C _ arr[j])<
        db 3CH, 28H, 61H, 72H, 72H, 5BH, 6AH, 5DH       ; 0044 _ <(arr[j]
        db 3CH, 30H, 29H, 29H, 2BH, 28H, 28H, 61H       ; 004C _ <0))+((a
        db 72H, 72H, 5BH, 6AH, 5DH, 29H, 3CH, 3CH       ; 0054 _ rr[j])<<
        db 28H, 61H, 72H, 72H, 5BH, 6AH, 5DH, 3EH       ; 005C _ (arr[j]>
        db 30H, 29H, 29H, 3BH, 20H, 43H, 79H, 63H       ; 0064 _ 0)); Cyc
        db 6CH, 65H, 73H, 20H, 73H, 70H, 65H, 6EH       ; 006C _ les spen
        db 74H, 3AH, 25H, 6CH, 6CH, 75H, 0AH, 00H       ; 0074 _ t:%llu..

_DATA   ENDS

CONST   SEGMENT DWORD PUBLIC 'CONST'                    ; section number 3

CONST   ENDS

_BSS    SEGMENT DWORD PUBLIC 'BSS'                      ; section number 4

_BSS    ENDS

_text$_rdtsc SEGMENT DWORD PUBLIC 'CODE'                ; section number 5
;  Communal section not supported by MASM

_rdtsc  PROC NEAR
;  COMDEF _rdtsc
        rdtsc                                           ; 0000 _ 0F 31
        ret                                             ; 0002 _ C3
_rdtsc  ENDP

_text$_rdtsc ENDS

END

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 13:08

The code with |0 which magically speeds it up(like in JavaScript..)
; Disassembly of file: abs.obj
; Sat Nov 05 19:49:12 2011
; Mode: 32 bits
; Syntax: MASM/ML
; Instruction set: Pentium

.586
.model flat

public _main
public _rdtsc                                           ; Note: Communal. Not supported by MASM

extern _rand: near
extern _printf: near
extern _rdtsc: near
extern __acrtused_con: byte

FLAT    GROUP


_TEXT   SEGMENT DWORD PUBLIC 'CODE'                     ; section number 1

_main   PROC NEAR
        push    ebp                                     ; 0000 _ 55
        mov     ebp, esp                                ; 0001 _ 8B. EC
        mov     edx, 9                                  ; 0003 _ BA, 00000009
?_001:  sub     esp, 4096                               ; 0008 _ 81. EC, 00001000
        test    dword ptr [esp], esp                    ; 000E _ 85. 24 24
        dec     edx                                     ; 0011 _ 4A
        jnz     ?_001                                   ; 0012 _ 75, F4
        sub     esp, 3160                               ; 0014 _ 81. EC, 00000C58
        push    ebx                                     ; 001A _ 53
        push    esi                                     ; 001B _ 56
        push    edi                                     ; 001C _ 57
        mov     dword ptr [ebp-9C50H], 0                ; 001D _ C7. 85, FFFF63B0, 00000000
?_002:  cmp     dword ptr [ebp-9C50H], 10000            ; 0027 _ 81. BD, FFFF63B0, 00002710
        jge     ?_003                                   ; 0031 _ 7D, 28
        call    _rand                                   ; 0033 _ E8, 00000000(rel)
        mov     ecx, 10000                              ; 0038 _ B9, 00002710
        cdq                                             ; 003D _ 99
        idiv    ecx                                     ; 003E _ F7. F9
        add     edx, -5000                              ; 0040 _ 81. C2, FFFFEC78
        mov     eax, dword ptr [ebp-9C50H]              ; 0046 _ 8B. 85, FFFF63B0
        mov     dword ptr [ebp+eax*4-9C40H], edx        ; 004C _ 89. 94 85, FFFF63C0
        inc     dword ptr [ebp-9C50H]                   ; 0053 _ FF. 85, FFFF63B0
        jmp     ?_002                                   ; 0059 _ EB, CC

?_003:  call    _rdtsc                                  ; 005B _ E8, 00000000(rel)
        mov     dword ptr [ebp-9C48H], eax              ; 0060 _ 89. 85, FFFF63B8
        mov     dword ptr [ebp-9C44H], edx              ; 0066 _ 89. 95, FFFF63BC
        mov     dword ptr [ebp-9C4CH], 0                ; 006C _ C7. 85, FFFF63B4, 00000000
?_004:  cmp     dword ptr [ebp-9C4CH], 10000            ; 0076 _ 81. BD, FFFF63B4, 00002710
        jge     ?_007                                   ; 0080 _ 7D, 1D
        mov     edx, dword ptr [ebp-9C4CH]              ; 0082 _ 8B. 95, FFFF63B4
        mov     ebx, dword ptr [ebp+edx*4-9C40H]        ; 0088 _ 8B. 9C 95, FFFF63C0
        test    ebx, ebx                                ; 008F _ 85. DB
        jle     ?_005                                   ; 0091 _ 7E, 02
        jmp     ?_006                                   ; 0093 _ EB, 02

?_005:  neg     ebx                                     ; 0095 _ F7. DB
?_006:  inc     dword ptr [ebp-9C4CH]                   ; 0097 _ FF. 85, FFFF63B4
        jmp     ?_004                                   ; 009D _ EB, D7

?_007:  call    _rdtsc                                  ; 009F _ E8, 00000000(rel)
        sub     eax, dword ptr [ebp-9C48H]              ; 00A4 _ 2B. 85, FFFF63B8
        sbb     edx, dword ptr [ebp-9C44H]              ; 00AA _ 1B. 95, FFFF63BC
        push    edx                                     ; 00B0 _ 52
        push    eax                                     ; 00B1 _ 50
        push    offset FLAT:?_010                       ; 00B2 _ 68, 00000000(segrel)
        call    _printf                                 ; 00B7 _ E8, 00000000(rel)
        call    _rdtsc                                  ; 00BC _ E8, 00000000(rel)
        mov     dword ptr [ebp-9C48H], eax              ; 00C1 _ 89. 85, FFFF63B8
        mov     dword ptr [ebp-9C44H], edx              ; 00C7 _ 89. 95, FFFF63BC
        add     esp, 12                                 ; 00CD _ 83. C4, 0C
        mov     dword ptr [ebp-9C4CH], 0                ; 00D0 _ C7. 85, FFFF63B4, 00000000
?_008:  cmp     dword ptr [ebp-9C4CH], 10000            ; 00DA _ 81. BD, FFFF63B4, 00002710
        jge     ?_009                                   ; 00E4 _ 7D, 3C
        mov     esi, dword ptr [ebp-9C4CH]              ; 00E6 _ 8B. B5, FFFF63B4
        mov     edi, dword ptr [ebp+esi*4-9C40H]        ; 00EC _ 8B. BC B5, FFFF63C0
        mov     dword ptr [ebp-9C54H], edi              ; 00F3 _ 89. BD, FFFF63AC
        neg     edi                                     ; 00F9 _ F7. DF
        mov     ecx, dword ptr [ebp-9C54H]              ; 00FB _ 8B. 8D, FFFF63AC
        shr     ecx, 31                                 ; 0101 _ C1. E9, 1F
        shl     edi, cl                                 ; 0104 _ D3. E7
        mov     eax, dword ptr [ebp-9C54H]              ; 0106 _ 8B. 85, FFFF63AC
        mov     ecx, eax                                ; 010C _ 89. C1
        neg     ecx                                     ; 010E _ F7. D9
        sbb     ecx, 0                                  ; 0110 _ 83. D9, 00
        shr     ecx, 31                                 ; 0113 _ C1. E9, 1F
        shl     eax, cl                                 ; 0116 _ D3. E0
        add     edi, eax                                ; 0118 _ 03. F8
        inc     dword ptr [ebp-9C4CH]                   ; 011A _ FF. 85, FFFF63B4
        jmp     ?_008                                   ; 0120 _ EB, B8

?_009:  call    _rdtsc                                  ; 0122 _ E8, 00000000(rel)
        sub     eax, dword ptr [ebp-9C48H]              ; 0127 _ 2B. 85, FFFF63B8
        sbb     edx, dword ptr [ebp-9C44H]              ; 012D _ 1B. 95, FFFF63BC
        push    edx                                     ; 0133 _ 52
        push    eax                                     ; 0134 _ 50
        push    offset FLAT:?_011                       ; 0135 _ 68, 00000034(segrel)
        call    _printf                                 ; 013A _ E8, 00000000(rel)
        xor     eax, eax                                ; 013F _ 31. C0
        add     esp, 12                                 ; 0141 _ 83. C4, 0C
        pop     edi                                     ; 0144 _ 5F
        pop     esi                                     ; 0145 _ 5E
        pop     ebx                                     ; 0146 _ 5B
        leave                                           ; 0147 _ C9
        ret                                             ; 0148 _ C3
_main   ENDP

_TEXT   ENDS

_DATA   SEGMENT DWORD PUBLIC 'DATA'                     ; section number 2

?_010   label byte
        db 7AH, 20H, 3DH, 20H, 61H, 72H, 72H, 5BH       ; 0000 _ z = arr[
        db 6AH, 5DH, 3EH, 30H, 3FH, 61H, 72H, 72H       ; 0008 _ j]>0?arr
        db 5BH, 6AH, 5DH, 3AH, 2DH, 61H, 72H, 72H       ; 0010 _ [j]:-arr
        db 5BH, 6AH, 5DH, 3BH, 20H, 20H, 20H, 20H       ; 0018 _ [j];   
        db 43H, 79H, 63H, 6CH, 65H, 73H, 20H, 73H       ; 0020 _ Cycles s
        db 70H, 65H, 6EH, 74H, 3AH, 25H, 6CH, 6CH       ; 0028 _ pent:%ll
        db 75H, 0AH, 00H, 00H                           ; 0030 _ u...

?_011   label byte
        db 20H, 7AH, 20H, 3DH, 20H, 28H, 28H, 2DH       ; 0034 _  z = ((-
        db 61H, 72H, 72H, 5BH, 6AH, 5DH, 29H, 3CH       ; 003C _ arr[j])<
        db 3CH, 28H, 61H, 72H, 72H, 5BH, 6AH, 5DH       ; 0044 _ <(arr[j]
        db 3CH, 30H, 29H, 29H, 2BH, 28H, 28H, 61H       ; 004C _ <0))+((a
        db 72H, 72H, 5BH, 6AH, 5DH, 29H, 3CH, 3CH       ; 0054 _ rr[j])<<
        db 28H, 61H, 72H, 72H, 5BH, 6AH, 5DH, 3EH       ; 005C _ (arr[j]>
        db 30H, 29H, 29H, 3BH, 20H, 43H, 79H, 63H       ; 0064 _ 0)); Cyc
        db 6CH, 65H, 73H, 20H, 73H, 70H, 65H, 6EH       ; 006C _ les spen
        db 74H, 3AH, 25H, 6CH, 6CH, 75H, 0AH, 00H       ; 0074 _ t:%llu..

_DATA   ENDS

CONST   SEGMENT DWORD PUBLIC 'CONST'                    ; section number 3

CONST   ENDS

_BSS    SEGMENT DWORD PUBLIC 'BSS'                      ; section number 4

_BSS    ENDS

_text$_rdtsc SEGMENT DWORD PUBLIC 'CODE'                ; section number 5
;  Communal section not supported by MASM

_rdtsc  PROC NEAR
;  COMDEF _rdtsc
        rdtsc                                           ; 0000 _ 0F 31
        ret                                             ; 0002 _ C3
_rdtsc  ENDP

_text$_rdtsc ENDS

END

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 13:10

wrong code this one is it:
; Disassembly of file: abs.obj
; Sat Nov 05 19:53:45 2011
; Mode: 32 bits
; Syntax: MASM/ML
; Instruction set: Pentium

.586
.model flat

public _main
public _rdtsc                                           ; Note: Communal. Not supported by MASM

extern _rand: near
extern _printf: near
extern _rdtsc: near
extern __acrtused_con: byte

FLAT    GROUP


_TEXT   SEGMENT DWORD PUBLIC 'CODE'                     ; section number 1

_main   PROC NEAR
        push    ebp                                     ; 0000 _ 55
        mov     ebp, esp                                ; 0001 _ 8B. EC
        mov     edx, 9                                  ; 0003 _ BA, 00000009
?_001:  sub     esp, 4096                               ; 0008 _ 81. EC, 00001000
        test    dword ptr [esp], esp                    ; 000E _ 85. 24 24
        dec     edx                                     ; 0011 _ 4A
        jnz     ?_001                                   ; 0012 _ 75, F4
        sub     esp, 3160                               ; 0014 _ 81. EC, 00000C58
        push    ebx                                     ; 001A _ 53
        push    esi                                     ; 001B _ 56
        push    edi                                     ; 001C _ 57
        mov     dword ptr [ebp-9C50H], 0                ; 001D _ C7. 85, FFFF63B0, 00000000
?_002:  cmp     dword ptr [ebp-9C50H], 10000            ; 0027 _ 81. BD, FFFF63B0, 00002710
        jge     ?_003                                   ; 0031 _ 7D, 28
        call    _rand                                   ; 0033 _ E8, 00000000(rel)
        mov     ecx, 10000                              ; 0038 _ B9, 00002710
        cdq                                             ; 003D _ 99
        idiv    ecx                                     ; 003E _ F7. F9
        add     edx, -5000                              ; 0040 _ 81. C2, FFFFEC78
        mov     eax, dword ptr [ebp-9C50H]              ; 0046 _ 8B. 85, FFFF63B0
        mov     dword ptr [ebp+eax*4-9C40H], edx        ; 004C _ 89. 94 85, FFFF63C0
        inc     dword ptr [ebp-9C50H]                   ; 0053 _ FF. 85, FFFF63B0
        jmp     ?_002                                   ; 0059 _ EB, CC

?_003:  call    _rdtsc                                  ; 005B _ E8, 00000000(rel)
        mov     dword ptr [ebp-9C48H], eax              ; 0060 _ 89. 85, FFFF63B8
        mov     dword ptr [ebp-9C44H], edx              ; 0066 _ 89. 95, FFFF63BC
        mov     dword ptr [ebp-9C4CH], 0                ; 006C _ C7. 85, FFFF63B4, 00000000
?_004:  cmp     dword ptr [ebp-9C4CH], 10000            ; 0076 _ 81. BD, FFFF63B4, 00002710
        jge     ?_007                                   ; 0080 _ 7D, 1D
        mov     edx, dword ptr [ebp-9C4CH]              ; 0082 _ 8B. 95, FFFF63B4
        mov     ebx, dword ptr [ebp+edx*4-9C40H]        ; 0088 _ 8B. 9C 95, FFFF63C0
        test    ebx, ebx                                ; 008F _ 85. DB
        jle     ?_005                                   ; 0091 _ 7E, 02
        jmp     ?_006                                   ; 0093 _ EB, 02

?_005:  neg     ebx                                     ; 0095 _ F7. DB
?_006:  inc     dword ptr [ebp-9C4CH]                   ; 0097 _ FF. 85, FFFF63B4
        jmp     ?_004                                   ; 009D _ EB, D7

?_007:  call    _rdtsc                                  ; 009F _ E8, 00000000(rel)
        sub     eax, dword ptr [ebp-9C48H]              ; 00A4 _ 2B. 85, FFFF63B8
        sbb     edx, dword ptr [ebp-9C44H]              ; 00AA _ 1B. 95, FFFF63BC
        push    edx                                     ; 00B0 _ 52
        push    eax                                     ; 00B1 _ 50
        push    offset FLAT:?_010                       ; 00B2 _ 68, 00000000(segrel)
        call    _printf                                 ; 00B7 _ E8, 00000000(rel)
        call    _rdtsc                                  ; 00BC _ E8, 00000000(rel)
        mov     dword ptr [ebp-9C48H], eax              ; 00C1 _ 89. 85, FFFF63B8
        mov     dword ptr [ebp-9C44H], edx              ; 00C7 _ 89. 95, FFFF63BC
        add     esp, 12                                 ; 00CD _ 83. C4, 0C
        mov     dword ptr [ebp-9C4CH], 0                ; 00D0 _ C7. 85, FFFF63B4, 00000000
?_008:  cmp     dword ptr [ebp-9C4CH], 10000            ; 00DA _ 81. BD, FFFF63B4, 00002710
        jge     ?_009                                   ; 00E4 _ 7D, 2F
        mov     esi, dword ptr [ebp-9C4CH]              ; 00E6 _ 8B. B5, FFFF63B4
        mov     ecx, dword ptr [ebp+esi*4-9C40H]        ; 00EC _ 8B. 8C B5, FFFF63C0
        mov     dword ptr [ebp-9C54H], ecx              ; 00F3 _ 89. 8D, FFFF63AC
        add     ecx, ecx                                ; 00F9 _ 01. C9
        sbb     ecx, ecx                                ; 00FB _ 19. C9
        inc     ecx                                     ; 00FD _ 41
; Note: Displacement could be made smaller by sign extension
        lea     eax, [ecx*2-1H]                         ; 00FE _ 8D. 04 4D, FFFFFFFF
        mov     edi, dword ptr [ebp-9C54H]              ; 0105 _ 8B. BD, FFFF63AC
        imul    edi                                     ; 010B _ F7. EF
        inc     dword ptr [ebp-9C4CH]                   ; 010D _ FF. 85, FFFF63B4
        jmp     ?_008                                   ; 0113 _ EB, C5

?_009:  call    _rdtsc                                  ; 0115 _ E8, 00000000(rel)
        sub     eax, dword ptr [ebp-9C48H]              ; 011A _ 2B. 85, FFFF63B8
        sbb     edx, dword ptr [ebp-9C44H]              ; 0120 _ 1B. 95, FFFF63BC
        push    edx                                     ; 0126 _ 52
        push    eax                                     ; 0127 _ 50
        push    offset FLAT:?_010                       ; 0128 _ 68, 00000000(segrel)
        call    _printf                                 ; 012D _ E8, 00000000(rel)
        xor     eax, eax                                ; 0132 _ 31. C0
        add     esp, 12                                 ; 0134 _ 83. C4, 0C
        pop     edi                                     ; 0137 _ 5F
        pop     esi                                     ; 0138 _ 5E
        pop     ebx                                     ; 0139 _ 5B
        leave                                           ; 013A _ C9
        ret                                             ; 013B _ C3
_main   ENDP

_TEXT   ENDS

_DATA   SEGMENT DWORD PUBLIC 'DATA'                     ; section number 2

?_010   label byte
        db 43H, 79H, 63H, 6CH, 65H, 73H, 20H, 73H       ; 0000 _ Cycles s
        db 70H, 65H, 6EH, 74H, 3AH, 25H, 6CH, 6CH       ; 0008 _ pent:%ll
        db 75H, 0AH, 00H                                ; 0010 _ u..

_DATA   ENDS

CONST   SEGMENT DWORD PUBLIC 'CONST'                    ; section number 3

CONST   ENDS

_BSS    SEGMENT DWORD PUBLIC 'BSS'                      ; section number 4

_BSS    ENDS

_text$_rdtsc SEGMENT DWORD PUBLIC 'CODE'                ; section number 5
;  Communal section not supported by MASM

_rdtsc  PROC NEAR
;  COMDEF _rdtsc
        rdtsc                                           ; 0000 _ 0F 31
        ret                                             ; 0002 _ C3
_rdtsc  ENDP

_text$_rdtsc ENDS

END

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 13:38

the |0 is optimized out in both cases but 10-30k cycles faster in unoptimized code and no difference with optimizations
?_008:  cmp     dword ptr [ebp-9C4CH], 10000            ; 00DA _ 81. BD, FFFF63B4, 00002710
        jge     ?_009                                   ; 00E4 _ 7D, 2F
        mov     esi, dword ptr [ebp-9C4CH]              ; 00E6 _ 8B. B5, FFFF63B4
        mov     ecx, dword ptr [ebp+esi*4-9C40H]        ; 00EC _ 8B. 8C B5, FFFF63C0
        mov     dword ptr [ebp-9C54H], ecx              ; 00F3 _ 89. 8D, FFFF63AC
        add     ecx, ecx                                ; 00F9 _ 01. C9
        sbb     ecx, ecx                                ; 00FB _ 19. C9
        inc     ecx                                     ; 00FD _ 41
; Note: Displacement could be made smaller by sign extension
        lea     eax, [ecx*2-1H]                         ; 00FE _ 8D. 04 4D, FFFFFFFF
        mov     edi, dword ptr [ebp-9C54H]              ; 0105 _ 8B. BD, FFFF63AC
        imul    edi                                     ; 010B _ F7. EF
        inc     dword ptr [ebp-9C4CH]                   ; 010D _ FF. 85, FFFF63B4
        jmp     ?_008                                   ; 0113 _ EB, C5

C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:204936
Cycles spent:169202

C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:194130
Cycles spent:170980

C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:204349
Cycles spent:181916

C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:195272
Cycles spent:176976

C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:192524
Cycles spent:175714

C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:193632
Cycles spent:113145

C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:190078
Cycles spent:173470

C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:193900
Cycles spent:172050

C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:189760
Cycles spent:173576

C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:192497
Cycles spent:170216

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 13:48

Conclusion: no magic occurs, ternary just get optimized very well by DMC and branchless bithacks are equivalent speed but -3% faster when unoptimized code is generated. This is optimized code with ternary vs bithack without |0:(ternary wins by 17 cycles)
C:\Program Files\dmc8.50\dmc\dm\bin\code>abs
Cycles spent:30110
Cycles spent:30127
; Disassembly of file: abs.obj
; Sat Nov 05 20:18:42 2011
; Mode: 32 bits
; Syntax: MASM/ML
; Instruction set: Pentium

.586
.model flat

public _main
public _rdtsc                                           ; Note: Communal. Not supported by MASM

extern _rand: near
extern _printf: near
extern _rdtsc: near
extern __acrtused_con: byte

FLAT    GROUP


_TEXT   SEGMENT DWORD PUBLIC 'CODE'                     ; section number 1

_main   PROC NEAR
        push    ebp                                     ; 0000 _ 55
        mov     ebp, esp                                ; 0001 _ 8B. EC
        mov     edx, 9                                  ; 0003 _ BA, 00000009
?_001:  sub     esp, 4096                               ; 0008 _ 81. EC, 00001000
        test    dword ptr [esp], esp                    ; 000E _ 85. 24 24
        dec     edx                                     ; 0011 _ 4A
        jnz     ?_001                                   ; 0012 _ 75, F4
        sub     esp, 3160                               ; 0014 _ 81. EC, 00000C58
        push    ebx                                     ; 001A _ 53
        push    esi                                     ; 001B _ 56
        push    edi                                     ; 001C _ 57
        mov     dword ptr [ebp-9C50H], 0                ; 001D _ C7. 85, FFFF63B0, 00000000
?_002:  cmp     dword ptr [ebp-9C50H], 10000            ; 0027 _ 81. BD, FFFF63B0, 00002710
        jge     ?_003                                   ; 0031 _ 7D, 28
        call    _rand                                   ; 0033 _ E8, 00000000(rel)
        mov     ecx, 10000                              ; 0038 _ B9, 00002710
        cdq                                             ; 003D _ 99
        idiv    ecx                                     ; 003E _ F7. F9
        add     edx, -5000                              ; 0040 _ 81. C2, FFFFEC78
        mov     eax, dword ptr [ebp-9C50H]              ; 0046 _ 8B. 85, FFFF63B0
        mov     dword ptr [ebp+eax*4-9C40H], edx        ; 004C _ 89. 94 85, FFFF63C0
        inc     dword ptr [ebp-9C50H]                   ; 0053 _ FF. 85, FFFF63B0
        jmp     ?_002                                   ; 0059 _ EB, CC

?_003:  call    _rdtsc                                  ; 005B _ E8, 00000000(rel)
        mov     dword ptr [ebp-9C48H], eax              ; 0060 _ 89. 85, FFFF63B8
        mov     dword ptr [ebp-9C44H], edx              ; 0066 _ 89. 95, FFFF63BC
        mov     dword ptr [ebp-9C4CH], 0                ; 006C _ C7. 85, FFFF63B4, 00000000
?_004:  cmp     dword ptr [ebp-9C4CH], 10000            ; 0076 _ 81. BD, FFFF63B4, 00002710
        jge     ?_007                                   ; 0080 _ 7D, 1D
        mov     edx, dword ptr [ebp-9C4CH]              ; 0082 _ 8B. 95, FFFF63B4
        mov     ebx, dword ptr [ebp+edx*4-9C40H]        ; 0088 _ 8B. 9C 95, FFFF63C0
        test    ebx, ebx                                ; 008F _ 85. DB
        jle     ?_005                                   ; 0091 _ 7E, 02
        jmp     ?_006                                   ; 0093 _ EB, 02

?_005:  neg     ebx                                     ; 0095 _ F7. DB
?_006:  inc     dword ptr [ebp-9C4CH]                   ; 0097 _ FF. 85, FFFF63B4
        jmp     ?_004                                   ; 009D _ EB, D7

?_007:  call    _rdtsc                                  ; 009F _ E8, 00000000(rel)
        sub     eax, dword ptr [ebp-9C48H]              ; 00A4 _ 2B. 85, FFFF63B8
        sbb     edx, dword ptr [ebp-9C44H]              ; 00AA _ 1B. 95, FFFF63BC
        push    edx                                     ; 00B0 _ 52
        push    eax                                     ; 00B1 _ 50
        push    offset FLAT:?_010                       ; 00B2 _ 68, 00000000(segrel)
        call    _printf                                 ; 00B7 _ E8, 00000000(rel)
        call    _rdtsc                                  ; 00BC _ E8, 00000000(rel)
        mov     dword ptr [ebp-9C48H], eax              ; 00C1 _ 89. 85, FFFF63B8
        mov     dword ptr [ebp-9C44H], edx              ; 00C7 _ 89. 95, FFFF63BC
        add     esp, 12                                 ; 00CD _ 83. C4, 0C
        mov     dword ptr [ebp-9C4CH], 0                ; 00D0 _ C7. 85, FFFF63B4, 00000000
?_008:  cmp     dword ptr [ebp-9C4CH], 10000            ; 00DA _ 81. BD, FFFF63B4, 00002710
        jge     ?_009                                   ; 00E4 _ 7D, 2F
        mov     esi, dword ptr [ebp-9C4CH]              ; 00E6 _ 8B. B5, FFFF63B4
        mov     ecx, dword ptr [ebp+esi*4-9C40H]        ; 00EC _ 8B. 8C B5, FFFF63C0
        mov     dword ptr [ebp-9C54H], ecx              ; 00F3 _ 89. 8D, FFFF63AC
        add     ecx, ecx                                ; 00F9 _ 01. C9
        sbb     ecx, ecx                                ; 00FB _ 19. C9
        inc     ecx                                     ; 00FD _ 41
; Note: Displacement could be made smaller by sign extension
        lea     eax, [ecx*2-1H]                         ; 00FE _ 8D. 04 4D, FFFFFFFF
        mov     edi, dword ptr [ebp-9C54H]              ; 0105 _ 8B. BD, FFFF63AC
        imul    edi                                     ; 010B _ F7. EF
        inc     dword ptr [ebp-9C4CH]                   ; 010D _ FF. 85, FFFF63B4
        jmp     ?_008                                   ; 0113 _ EB, C5

?_009:  call    _rdtsc                                  ; 0115 _ E8, 00000000(rel)
        sub     eax, dword ptr [ebp-9C48H]              ; 011A _ 2B. 85, FFFF63B8
        sbb     edx, dword ptr [ebp-9C44H]              ; 0120 _ 1B. 95, FFFF63BC
        push    edx                                     ; 0126 _ 52
        push    eax                                     ; 0127 _ 50
        push    offset FLAT:?_010                       ; 0128 _ 68, 00000000(segrel)
        call    _printf                                 ; 012D _ E8, 00000000(rel)
        xor     eax, eax                                ; 0132 _ 31. C0
        add     esp, 12                                 ; 0134 _ 83. C4, 0C
        pop     edi                                     ; 0137 _ 5F
        pop     esi                                     ; 0138 _ 5E
        pop     ebx                                     ; 0139 _ 5B
        leave                                           ; 013A _ C9
        ret                                             ; 013B _ C3
_main   ENDP

_TEXT   ENDS

_DATA   SEGMENT DWORD PUBLIC 'DATA'                     ; section number 2

?_010   label byte
        db 43H, 79H, 63H, 6CH, 65H, 73H, 20H, 73H       ; 0000 _ Cycles s
        db 70H, 65H, 6EH, 74H, 3AH, 25H, 6CH, 6CH       ; 0008 _ pent:%ll
        db 75H, 0AH, 00H                                ; 0010 _ u..

_DATA   ENDS

CONST   SEGMENT DWORD PUBLIC 'CONST'                    ; section number 3

CONST   ENDS

_BSS    SEGMENT DWORD PUBLIC 'BSS'                      ; section number 4

_BSS    ENDS

_text$_rdtsc SEGMENT DWORD PUBLIC 'CODE'                ; section number 5
;  Communal section not supported by MASM

_rdtsc  PROC NEAR
;  COMDEF _rdtsc
        rdtsc                                           ; 0000 _ 0F 31
        ret                                             ; 0002 _ C3
_rdtsc  ENDP

_text$_rdtsc ENDS

END

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 13:52

|0 is never present in the code: both cases in unoptimized code win over ternary.
Optimized code results in same speed for both(about 10-20 cycles difference)

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-05 14:04

>>261 i meant +30% faster. I'm going to sleep now.

Name: Anonymous 2011-11-05 14:59

http://codepad.org/NTrrmr2O
Branch: 1670000
Bit hack: 1860000
Subtraction: 2350000
XOR with sign: 1770000
asm: 1660000
abs(): 1670000


On an Atom processor, compiled with GCC 4.6.1, with no optimizations.
Sorry if it's less that optimal, I'm not that good with asm.

Name: Anonymous 2011-11-05 15:28

>>264
arr[i] = i % 2 ? 123456789 : -123456789 ; // random values would be stupid
>CPUs without branch predictors would be even more stupid

Name: Anonymous 2011-11-05 15:31

>>265
With random values, it's possible that you'll get positive numbers everywhere.

Name: Anonymous 2011-11-05 20:23

I've reached satori like a beast and shat myself. Thanx op.

Name: Anonymous 2011-11-06 0:18

>>266
Without random values you always get positive number at even cells. You're an obvious troll.

Name: Anonymous 2011-11-06 1:01

"I'm waiting when JS will get native Int32 type"

is that ever going to happen? there's no mention of it on the harmony wiki for example

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-06 1:20

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-06 1:29

You can see they practically can add this feature easily by yourself.
https://developer.mozilla.org/en/js-ctypes/Using_js-ctypes/Working_with_data

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-06 1:33

uint32_t     Unsigned 32-bit integer.
int64_t     Signed 64-bit integer.
These are the ones i want supported and not in the way with Int64 "object"
Note: Some 64-bit values are outside the range of numeric values supported by JavaScript. Because of this, ctypes.int64 and ctypes.uint64 do not automatically convert to JavaScript numbers. Instead, they convert to objects of the wrapper types ctypes.Int64 and ctypes.UInt64, which are JavaScript objects rather than CData objects. See 64-bit integers for details.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-06 1:36

https://wiki.mozilla.org/JSctypes
They only provide it to extension developers

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-06 1:41

Mozilla is retarded, they are sitting on a technology that enables C-level performance without any hacks.
They still insist all JS cludges need to be preserved and every interaction with a datatype is done on objects rather than JITting opcodes to primitive C types(which all the code eventually does in some way, since Sepples is not a magical sandbox).

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-06 2:49

>>269
Also, ECMA is insufferable ancient bureaucracy that should have no place to decide what JS becomes.
Once a single decent browser implements native C types and efficient JIT without GC(no GC whatsoever) everyone else will strive to copy it or be left in the dust. And i have couple of ideas that make performance of browsers skyrocket
1. Prototypes are made C function pointers. Prototypes can be aliased, exchanged and set by code as pointer values.
2.All types are specifically either primitive(UInt32,Int8,Float64) or complex(Object,Array) and there is no implicit type conversion on primitives. Primitives should run at full speed without any interference by JS engine.
3.GC should either be removed(delete and new are enough) or delegated to idle threads. Only when app is completely idle GC should start.
4.all assignment/retrieval/math operations on pritimives and arrays/objects consisting of primitive are translated to direct machine code without any method calls or checks to ensure ("the object is the right type and range of values").
5. JS canvas should have more options on format of data presented instead of 32bit pixel arrays which can be manipulated byte at a time(excluding specific hacks to move data with ImageData arrays). Canvas pixel array should have wide variety of pixel formats, transparency options and should can be manipulated easily with array ops and draw commands on raw data(not displayed pixles but PixelArray itself).e.g.
setRowOfPixels(single int color),setPixel(x,y,single int color), setRectangle(x=bottom left,y=top right,single int color)
6.WebGL has to be reworked as JS method API (with optional low-level code) and it has to be hardware independent(like canvas).

Name: Anonymous 2011-11-06 3:05

>>275
How do you dynamically and automatically manage memory without GC?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-06 3:33

In small apps which require a little memory you can ignore the leaks and concentrate on performance.
In big programs new and delete will be used to reclaim memory previously allocated(like malloc and free, but operating on typed objects)

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-06 3:35

If you want GC that badly just make it start on command like GC.cleanupStart or GC.enable like D runtime does

Name: Anonymous 2011-11-06 5:47

please, lose the trip, use sage if you have nothing to contribute and stop bumping your thread with stupid things everyone knows or nobody cares.

js will never get manual memory management. it might get more proper data types but there will be always some type and error checking. it was shit for last ~two decades and it will continue to be shit.

Name: Anonymous 2011-11-06 7:10

>>279
too much negative energy on this one

Name: Anonymous 2011-11-06 7:37

>>279
It's his own thread, let him be. We can also bump old threads with relevant new posts. Yes, he has a trip, yes it's slightly annoying but otherwise tolerable; you can use that information to block out his posts automatically using greasemonkey

http://userscripts.org/scripts/show/40415

Name: Anonymous 2011-11-06 8:21

>>279
StopWithYourNegativity
you | 0x1000000
positivity

Name: Anonymous 2011-11-06 13:27

>>281
finally, a good use for javascript

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-07 12:02

You can now view a version not in a "toy language" here:
http://dis.4chan.org/read/prog/1320683434/

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-08 13:15

Compact version:
<html><head><style>html,body{width:100%;height:100%;margin:0px;}
</style></head><body><canvas id='c' ></canvas></body>
<script>var inittime=Date.now();var starttime=Date.now()
const frcount=30 //more frames just repeat sine pattern
const zoom=0.125//optimal zoom for 1920x1080
var ic,co,sum,bug=0;
function check(){ if(!bug){bug=1;addtm("->R+")}}
function checkstr(str){ if(!bug){bug=1;addtm(str+".")}}
function checks(str){ if(!frame &&!flag){addtm(str)}}
function addtm(str){document.title+=Date.now()-starttime+str;starttime=Date.now()}
function settm(str){document.title=Date.now()-starttime+str;starttime=Date.now()}
function dump(a)document.writeln(a.toString())
var abs=Math.abs
var cos=Math.cos
var sin=Math.sin
var w =window.innerWidth
var h =window.innerHeight
w=w-w%8;//unroll factor
var halfantiw=w*0.5*zoom;
var halfantih=h*0.5*zoom;
var canvas3=document.getElementById('c');
var context=canvas3.getContext("2d");
canvas3.width=w;
canvas3.height=h;
const size=w*h*4
var elsize=w*h;elsize+=(4-(elsize%4))
var wint=[];
 for(i=0;i<frcount;i++){
wint[i]=Uint32Array(ArrayBuffer(elsize));}

var frame = 0,ccs;
var xcomcoss=Array(frcount)
var xcomsins=Array(frcount)
for(var co=0;co<frcount;co++){
ccs=co*0.20943951023931953
xcomcoss[co]=cos(ccs)
xcomsins[co]=sin(ccs)}
var i,preycache;
var preyfsin1cos=Array(h);
var preyfsin2cos=Array(h);
var preyfsin3cos=Array(h);
var preyfsin1sin=Array(h);
var preyfsin2sin=Array(h);
var preyfsin3sin=Array(h);
var pc1,pc2,pc3
for(i=0;i<h;i++){
preycache=i*zoom-halfantih;
pc1=preycache*0.4338837391175581
pc2=preycache*0.7818314824680298
pc3=preycache*0.9749279121818236
preyfsin1cos[i]=cos(pc1)
preyfsin1sin[i]=sin(pc1)
preyfsin2cos[i]=cos(pc2)
preyfsin2sin[i]=sin(pc2)
preyfsin3cos[i]=cos(pc3)
preyfsin3sin[i]=sin(pc3)
}

var prexs1cos=Array(w);
var prexs2cos=Array(w);
var prexs3cos=Array(w);
var hprecos=Array(w)
var hpresin=Array(w)

for(i=0;i<w;i++){
preycache=i*zoom - halfantiw
hpresin[i]=sin(preycache)*0.5
hprecos[i]=cos(preycache)*0.5
prexs1cos[i]=cos(preycache*0.9009688679024191)
prexs2cos[i]=cos(preycache*0.6234898018587336)
prexs3cos[i]=cos(preycache*0.22252093395631445)}
var prodxf1=Array(h)
var prodxs1=Array(h)
var p,p2,p3,p4,p5,p6,i,co
var pc1,pc2,pc3,pc4,pc5,pc6
var ec1,ec2,ec3;
for( i=0;i<h;i++){
prodxf1[i]=Array(w);
p=prodxf1[i];
prodxs1[i]=Array(w);
p4=prodxs1[i]
pc1=preyfsin1cos[i];
pc2=preyfsin2cos[i];
pc3=preyfsin3cos[i];
pc4=preyfsin1sin[i];
pc5=preyfsin2sin[i];
pc6=preyfsin3sin[i];
for(co=0;co<w;co++){
ec1=prexs1cos[co]
ec2=prexs2cos[co]
ec3=prexs3cos[co]
p[co]=pc1*ec1+pc2*ec2+pc3*ec3+hprecos[co];
p4[co]=pc4*ec1+pc5*ec2+pc6*ec3+hpresin[co];;}
}

function redraw(){
var d1,d2,d3,d4,d5,d6,d7,d8
var xf1,xs1,y,x,i,intload=wint[frame],xfracos=xcomcoss[frame%30],xfrasin=xcomsins[frame%30];
var r1,r2,r3,r4,r5,r6,r7,r8;
var temp1,temp2,temp3,temp4,temp5,temp6,temp7,temp8;

for(var y=0,i=0;y<h;y++){xf1=prodxf1[y];xs1=prodxs1[y];
for(x=0;x<w;x+=8) {
r1=3.5+xf1[x]*xfracos-xs1[x]*xfrasin
r2=3.5+xf1[x+1]*xfracos-xs1[x+1]*xfrasin
r3=3.5+xf1[x+2]*xfracos-xs1[x+2]*xfrasin
r4=3.5+xf1[x+3]*xfracos-xs1[x+3]*xfrasin
r5=3.5+xf1[x+4]*xfracos-xs1[x+4]*xfrasin
r6=3.5+xf1[x+5]*xfracos-xs1[x+5]*xfrasin
r7=3.5+xf1[x+6]*xfracos-xs1[x+6]*xfrasin
r8=3.5+xf1[x+7]*xfracos-xs1[x+7]*xfrasin
 temp1=(r1|0)
 temp2=(r2|0)
 temp3=(r3|0)
 temp4=(r4|0)
 temp5=(r5|0)
 temp6=(r6|0)
 temp7=(r7|0)
 temp8=(r8|0)
d1=(abs(temp1+(temp1&1)-r1)*0xff)
d2=(abs(temp2+(temp2&1)-r2)*0xff)
d3=(abs(temp3+(temp3&1)-r3)*0xff)
d4=(abs(temp4+(temp4&1)-r4)*0xff)
d5=(abs(temp5+(temp5&1)-r5)*0xff)
d6=(abs(temp6+(temp6&1)-r6)*0xff)
d7=(abs(temp7+(temp7&1)-r7)*0xff)
d8=(abs(temp8+(temp8&1)-r8)*0xff)
intload[i++]=(d1)|(d2<<8)|(d3<<16)|(d4<<24)
intload[i++]=(d5)|(d6<<8)|(d7<<16)|(d8<<24); }}}
while(frame<frcount){redraw();frame++;}
var RGB=[],ic,ir,ig,ib;
for(var ic=0;ic<0xff;ic++){
ir=ic-31;ir*=ir>2;ig=ic-81;ig*=ig>8;ig=ig<<8;ib=(ic)<<16
RGB[ic]=(ir|ig|ib)|0xff000000;}
var dispc=[];
window.requestAnimationFrame=window.requestAnimationFrame ||    window.webkitRequestAnimationFrame    || window.mozRequestAnimationFrame    || window.oRequestAnimationFrame    || window.msRequestAnimationFrame;
function dispframe(){if(++frame >= frcount)frame = 0;
if(!dispc[frame]){dispc[frame]={width:w,height:h,data:Uint8ClampedArray(ArrayBuffer(size))};
var tv=Uint32Array(dispc[frame].data.buffer);
var intpixels=Uint8Array(wint[frame].buffer);
for(var op=0,c=0;c<elsize;){tv[op++]=RGB[intpixels[c++]];}}
context.putImageData(dispc[frame],0,0);
window.requestAnimationFrame(dispframe);}
addtm("ms render");dispframe();
</script></html>

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 1:01

746ms - render
<html><head><style>html,body{width:100%;height:100%;margin:0px;}
</style></head><body><canvas id='c' ></canvas></body>
<script>var inittime=Date.now();var starttime=inittime;
function addtm(str){document.title+=Date.now()-starttime+str;starttime=Date.now()}
function settm(str){document.title=Date.now()-starttime+str;starttime=Date.now()}
function dump(a)document.writeln(a.toString())
var abs=Math.abs
var cos=Math.cos
var sin=Math.sin
var w =window.innerWidth
var h =window.innerHeight
w=w-w%8;//unroll factor
var halfantiw=w*0.0625;
var halfantih=h*0.0625;
var h8=h*8
var w8=w*8
var canvas3=document.getElementById('c');
var context=canvas3.getContext("2d");
canvas3.width=window.innerWidth;
canvas3.height=window.innerHeight;
const size=w*h*4
var elsize=w*h;elsize+=(4-(elsize%4))
var wint=[];
for(i=0;i<30;i++){wint[i]=Uint32Array(ArrayBuffer(elsize));}
var frame = 0;
var i,preycache;
var preyfsin1cos=Float64Array(ArrayBuffer(h8))
var preyfsin2cos=Float64Array(ArrayBuffer(h8))
var preyfsin3cos=Float64Array(ArrayBuffer(h8))
var preyfsin1sin=Float64Array(ArrayBuffer(h8))
var preyfsin2sin=Float64Array(ArrayBuffer(h8))
var preyfsin3sin=Float64Array(ArrayBuffer(h8))

var prexs1cos=Float64Array(ArrayBuffer(w8))
var prexs2cos=Float64Array(ArrayBuffer(w8))
var prexs3cos=Float64Array(ArrayBuffer(w8))
var hprecos=Float64Array(ArrayBuffer(w8))
var hpresin=Float64Array(ArrayBuffer(w8))

var prodxf1=Array(h)
var prodxs1=Array(h)
for( i=0;i<h;i++){
prodxf1[i]=Float64Array(ArrayBuffer(w8));
prodxs1[i]=Float64Array(ArrayBuffer(w8));
}



var pc1,pc2,pc3
for(i=0;i<h;i++){
preycache=i*0.125-halfantih;
pc1=preycache*0.4338837391175581
pc2=preycache*0.7818314824680298
pc3=preycache*0.9749279121818236
preyfsin1cos[i]=cos(pc1)
preyfsin1sin[i]=sin(pc1)
preyfsin2cos[i]=cos(pc2)
preyfsin2sin[i]=sin(pc2)
preyfsin3cos[i]=cos(pc3)
preyfsin3sin[i]=sin(pc3)
}



for(i=0;i<w;i++){
preycache=i*0.125 - halfantiw
hpresin[i]=sin(preycache)*0.5
hprecos[i]=cos(preycache)*0.5
prexs1cos[i]=cos(preycache*0.9009688679024191)
prexs2cos[i]=cos(preycache*0.6234898018587336)
prexs3cos[i]=cos(preycache*0.22252093395631445)}

var p,p2,p3,p4,p5,p6,i,co
var pc1,pc2,pc3,pc4,pc5,pc6
var ec1,ec2,ec3;

for( i=0;i<h;i++){
p=prodxf1[i];
p4=prodxs1[i]
pc1=preyfsin1cos[i];
pc2=preyfsin2cos[i];
pc3=preyfsin3cos[i];
pc4=preyfsin1sin[i];
pc5=preyfsin2sin[i];
pc6=preyfsin3sin[i];
for(co=0;co<w;co++){
ec1=prexs1cos[co]
ec2=prexs2cos[co]
ec3=prexs3cos[co]
p[co]=pc1*ec1+pc2*ec2+pc3*ec3+hprecos[co];
p4[co]=pc4*ec1+pc5*ec2+pc6*ec3+hpresin[co];;}
}
addtm("prec,")
function redraw(){
var d1,d2,d3,d4,d5,d6,d7,d8;
var n1,n2,n3,n4,n5,n6,n7,n8;
var xf1,xs1,y,x,i,intload=wint[frame],xfracos=cos(frame*0.20943951023931953),xfrasin=sin(0.20943951023931953*frame++);
var r1,r2,r3,r4,r5,r6,r7,r8;
var temp1,temp2,temp3,temp4,temp5,temp6,temp7,temp8;
for(var y=0,i=0;y<h;y++){xf1=prodxf1[y];xs1=prodxs1[y];
for(x=0;x<w;x+=8) {
r1=3.5+xf1[x]*xfracos-xs1[x]*xfrasin
r2=3.5+xf1[x+1]*xfracos-xs1[x+1]*xfrasin
r3=3.5+xf1[x+2]*xfracos-xs1[x+2]*xfrasin
r4=3.5+xf1[x+3]*xfracos-xs1[x+3]*xfrasin
r5=3.5+xf1[x+4]*xfracos-xs1[x+4]*xfrasin
r6=3.5+xf1[x+5]*xfracos-xs1[x+5]*xfrasin
r7=3.5+xf1[x+6]*xfracos-xs1[x+6]*xfrasin
r8=3.5+xf1[x+7]*xfracos-xs1[x+7]*xfrasin
 temp1=(r1|0)
 temp2=(r2|0)
 temp3=(r3|0)
 temp4=(r4|0)
 temp5=(r5|0)
 temp6=(r6|0)
 temp7=(r7|0)
 temp8=(r8|0)
n1=(abs(temp1+(temp1&1)-r1)*0xff)
n2=(abs(temp2+(temp2&1)-r2)*0xff)
n3=(abs(temp3+(temp3&1)-r3)*0xff)
n4=(abs(temp4+(temp4&1)-r4)*0xff)
n5=(abs(temp5+(temp5&1)-r5)*0xff)
n6=(abs(temp6+(temp6&1)-r6)*0xff)
n7=(abs(temp7+(temp7&1)-r7)*0xff)
n8=(abs(temp8+(temp8&1)-r8)*0xff)
intload[i++]=(n1)|(n2<<8)|(n3<<16)|(n4<<24)
intload[i++]=(n5)|(n6<<8)|(n7<<16)|(n8<<24); }}}
while(frame<30)redraw();
var RGB=[],ic,ir,ig,ib;
for(var ic=0;ic<0xff;ic++){
ir=ic-31;ir*=ir>2;ig=ic-81;ig*=ig>8;ig=ig<<8;ib=(ic)<<16
RGB[ic]=(ir|ig|ib)|0xff000000;}
var dispc=[];
window.requestAnimationFrame=window.requestAnimationFrame ||    window.webkitRequestAnimationFrame    || window.mozRequestAnimationFrame    || window.oRequestAnimationFrame    || window.msRequestAnimationFrame;
function dispframe(){if(++frame >= 30)frame = 0;
if(!dispc[frame]){dispc[frame]={width:w,height:h,data:Uint8ClampedArray(ArrayBuffer(size))};
var tv=Uint32Array(dispc[frame].data.buffer);
var intpixels=Uint8Array(wint[frame].buffer);
for(var op=0,c=0;c<elsize;){tv[op++]=RGB[intpixels[c++]];}
delete(wint[frame]);}
context.putImageData(dispc[frame],0,0);
window.requestAnimationFrame(dispframe);}
addtm("ms render");dispframe();
</script></html>

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 1:27

735 ms
<html><head><style>html,body{width:100%;height:100%;margin:0px;}
</style></head><body><canvas id='c' ></canvas></body>
<script>var inittime=Date.now();var starttime=inittime;
function addtm(str){document.title+=Date.now()-starttime+str;starttime=Date.now()}
function settm(str){document.title=Date.now()-starttime+str;starttime=Date.now()}
function dump(a)document.writeln(a.toString())
var abs=Math.abs
var cos=Math.cos
var sin=Math.sin
var w=window.innerWidth
var h =window.innerHeight
w=w-w%8;//unroll factor
var halfantiw=w*0.0625;
var halfantih=h*0.0625;
var h8=h*8
var w8=w*8
var canvas3=document.getElementById('c');
var context=canvas3.getContext("2d");
canvas3.width=window.innerWidth;
canvas3.height=window.innerHeight;
const size=w*h*4
var elsize=w*h;elsize+=(4-(elsize%4))
var wint=[];
for(i=0;i<30;i++){wint[i]=Uint32Array(ArrayBuffer(elsize));}
var frame = 0;
var i,preycache;

var preyfsin1cos=Float64Array(ArrayBuffer(h8))
var preyfsin2cos=Float64Array(ArrayBuffer(h8))
var preyfsin3cos=Float64Array(ArrayBuffer(h8))
var preyfsin1sin=Float64Array(ArrayBuffer(h8))
var preyfsin2sin=Float64Array(ArrayBuffer(h8))
var preyfsin3sin=Float64Array(ArrayBuffer(h8))

var prexs1cos=Float64Array(ArrayBuffer(w8))
var prexs2cos=Float64Array(ArrayBuffer(w8))
var prexs3cos=Float64Array(ArrayBuffer(w8))
var hprecos=Float64Array(ArrayBuffer(w8))
var hpresin=Float64Array(ArrayBuffer(w8))
var prodxf1=Array(h)
var prodxs1=Array(h)
for( i=0;i<h;i++){
prodxf1[i]=Float64Array(ArrayBuffer(w8));
prodxs1[i]=Float64Array(ArrayBuffer(w8));
}



var pc1,pc2,pc3
for(i=0;i<h;i++){
preycache=i*0.125-halfantih;
pc1=preycache*0.4338837391175581
pc2=preycache*0.7818314824680298
pc3=preycache*0.9749279121818236
preyfsin1cos[i]=cos(pc1)
preyfsin1sin[i]=sin(pc1)
preyfsin2cos[i]=cos(pc2)
preyfsin2sin[i]=sin(pc2)
preyfsin3cos[i]=cos(pc3)
preyfsin3sin[i]=sin(pc3)
}



for(i=0;i<w;i++){
preycache=i*0.125 - halfantiw
hpresin[i]=sin(preycache)*0.5
hprecos[i]=cos(preycache)*0.5
prexs1cos[i]=cos(preycache*0.9009688679024191)
prexs2cos[i]=cos(preycache*0.6234898018587336)
prexs3cos[i]=cos(preycache*0.22252093395631445)}

var p,p2,p3,p4,p5,p6,i,co
var pc1,pc2,pc3,pc4,pc5,pc6
var ec1,ec2,ec3;
for( i=0;i<h;i++){
p=prodxf1[i];
p4=prodxs1[i]
pc1=preyfsin1cos[i];
pc2=preyfsin2cos[i];
pc3=preyfsin3cos[i];
pc4=preyfsin1sin[i];
pc5=preyfsin2sin[i];
pc6=preyfsin3sin[i];
for(co=0;co<w;co++){
ec1=prexs1cos[co]
ec2=prexs2cos[co]
ec3=prexs3cos[co]
p[co]=pc1*ec1+pc2*ec2+pc3*ec3+hprecos[co];
p4[co]=pc4*ec1+pc5*ec2+pc6*ec3+hpresin[co];;}
}

var rs=Float64Array(ArrayBuffer(64));
var ns=Float64Array(ArrayBuffer(64));
var temps=Int32Array(ArrayBuffer(32))
var lvars=Int32Array(ArrayBuffer(32))
function redraw(){
var xf1,xs1,y=lvars[0],x=lvars[1],i=lvars[2],intload=wint[frame],xfracos=cos(frame*0.20943951023931953),xfrasin=sin(0.20943951023931953*frame++);
var r1=rs[0],r2=rs[1],r3=rs[2],r4=rs[3],r5=rs[4],r6=rs[5],r7=rs[6],r8=rs[7];
var n1=ns[0],n2=ns[1],n3=ns[2],n4=ns[3],n5=ns[4],n6=ns[5],n7=ns[6],n8=ns[7];
var temp1=temps[0],temp2=temps[1],temp3=temps[2],temp4=temps[3],temp5=temps[4],temp6=temps[5],temp7=temps[6],temp8=temps[7];

for(var y=0,i=0;y<h;y++){xf1=prodxf1[y];xs1=prodxs1[y];
for(x=0;x<w;x+=8) {
r1=3.5+xf1[x]*xfracos-xs1[x]*xfrasin
r2=3.5+xf1[x+1]*xfracos-xs1[x+1]*xfrasin
r3=3.5+xf1[x+2]*xfracos-xs1[x+2]*xfrasin
r4=3.5+xf1[x+3]*xfracos-xs1[x+3]*xfrasin
r5=3.5+xf1[x+4]*xfracos-xs1[x+4]*xfrasin
r6=3.5+xf1[x+5]*xfracos-xs1[x+5]*xfrasin
r7=3.5+xf1[x+6]*xfracos-xs1[x+6]*xfrasin
r8=3.5+xf1[x+7]*xfracos-xs1[x+7]*xfrasin
 temp1=(r1|0)
 temp2=(r2|0)
 temp3=(r3|0)
 temp4=(r4|0)
 temp5=(r5|0)
 temp6=(r6|0)
 temp7=(r7|0)
 temp8=(r8|0)
n1=(abs(temp1+(temp1&1)-r1)*0xff)
n2=(abs(temp2+(temp2&1)-r2)*0xff)
n3=(abs(temp3+(temp3&1)-r3)*0xff)
n4=(abs(temp4+(temp4&1)-r4)*0xff)
n5=(abs(temp5+(temp5&1)-r5)*0xff)
n6=(abs(temp6+(temp6&1)-r6)*0xff)
n7=(abs(temp7+(temp7&1)-r7)*0xff)
n8=(abs(temp8+(temp8&1)-r8)*0xff)
intload[i++]=(n1)|(n2<<8)|(n3<<16)|(n4<<24)
intload[i++]=(n5)|(n6<<8)|(n7<<16)|(n8<<24); }}}
while(frame<30)redraw();
var RGB=[],ic,ir,ig,ib;
for(var ic=0;ic<0xff;ic++){
ir=ic-31;ir*=ir>2;ig=ic-81;ig*=ig>8;ig=ig<<8;ib=(ic)<<16
RGB[ic]=(ir|ig|ib)|0xff000000;}
var dispc=[];
window.requestAnimationFrame=window.requestAnimationFrame ||    window.webkitRequestAnimationFrame    || window.mozRequestAnimationFrame    || window.oRequestAnimationFrame    || window.msRequestAnimationFrame;
function dispframe(){if(++frame >= 30)frame = 0;
if(!dispc[frame]){dispc[frame]={width:w,height:h,data:Uint8ClampedArray(ArrayBuffer(size))};
var tv=Uint32Array(dispc[frame].data.buffer);
var intpixels=Uint8Array(wint[frame].buffer);
for(var op=0,c=0;c<elsize;){tv[op++]=RGB[intpixels[c++]];}
delete(wint[frame]);}
context.putImageData(dispc[frame],0,0);
window.requestAnimationFrame(dispframe);}
addtm("ms render");dispframe();
</script></html>

Name: Anonymous 2011-11-09 1:35

>>287

my browser no has Uint32Array

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 1:56

Download latest firefox http://nightly.mozilla.org/

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 1:58

Nightly can be installed along with old versions(it will not overwrite Firefox 3.6.2,and any extensions can be enabled if you use Nightly tester tools)

Name: Anonymous 2011-11-09 2:04

FROZENSHIT IS AN IDIOT
SAGE

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 10:35

*In my nightly setup i just set extensions.checkCompatibility->false in about:config but some could prefer the convenience of addons

Name: Anonymous 2011-11-09 12:06

>My shit only works on pre-pre-pre alpha nightly ghetto builds
Sure is [undelrine}[overline][strong][emphasis]EXPERT PROGRAMMER here.[/italic][/strong][/overtheline][/underline]

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 22:16

725ms minor changes
<html><head><style>html,body{width:100%;height:100%;margin:0px;}
</style></head><body><canvas id='c' ></canvas></body>
<script>//722ms new record
var inittime=Date.now();var starttime=inittime;
function addtm(str){document.title+=Date.now()-starttime+str;starttime=Date.now()}
function settm(str){document.title=Date.now()-starttime+str;starttime=Date.now()}
function dump(a)document.writeln(a.toString())
var abs=Math.abs
var cos=Math.cos
var sin=Math.sin
var w=window.innerWidth
var h =window.innerHeight
w=w-w%8;//unroll factor
var halfantiw=w*0.0625;
var halfantih=h*0.0625;
var h8=h*8
var w8=w*8;
var canvas3=document.getElementById('c');
var context=canvas3.getContext("2d");
canvas3.width=window.innerWidth;
canvas3.height=window.innerHeight;
const size=w*h*4
var elsize=w*h;elsize+=(4-(elsize%4))
var wint=[];
for(i=0;i<30;i++){wint[i]=Uint32Array(ArrayBuffer(elsize));}
var frame = 0;
var i,preycache;
var rs=Float64Array(ArrayBuffer(64));
var ns=Float64Array(ArrayBuffer(64));
var temps=Int32Array(ArrayBuffer(32))
var lvars=Int32Array(ArrayBuffer(32))
var fcos=Float64Array(ArrayBuffer(8*30));
var fsin=Float64Array(ArrayBuffer(8*30));

var preyfsin1cos=Float64Array(ArrayBuffer(h8))
var preyfsin2cos=Float64Array(ArrayBuffer(h8))
var preyfsin3cos=Float64Array(ArrayBuffer(h8))
var preyfsin1sin=Float64Array(ArrayBuffer(h8))
var preyfsin2sin=Float64Array(ArrayBuffer(h8))
var preyfsin3sin=Float64Array(ArrayBuffer(h8))

var prexs1cos=Float64Array(ArrayBuffer(w8))
var prexs2cos=Float64Array(ArrayBuffer(w8))
var prexs3cos=Float64Array(ArrayBuffer(w8))
var hprecos=Float64Array(ArrayBuffer(w8))
var hpresin=Float64Array(ArrayBuffer(w8))
var prodxf1=Array(h)
var prodxs1=Array(h)
for( i=0;i<h;i++){
prodxf1[i]=Float64Array(ArrayBuffer(w8));
prodxs1[i]=Float64Array(ArrayBuffer(w8));
}


for(i=0;i<30;i++){
fcos[i]=cos(i*0.20943951023931953)
fsin[i]=sin(i*0.20943951023931953)
}

var pc1,pc2,pc3
for(i=0;i<h;i++){
preycache=i*0.125-halfantih;
pc1=preycache*0.4338837391175581
pc2=preycache*0.7818314824680298
pc3=preycache*0.9749279121818236
preyfsin1cos[i]=cos(pc1)
preyfsin1sin[i]=sin(pc1)
preyfsin2cos[i]=cos(pc2)
preyfsin2sin[i]=sin(pc2)
preyfsin3cos[i]=cos(pc3)
preyfsin3sin[i]=sin(pc3)
}



for(i=0;i<w;i++){
preycache=i*0.125 - halfantiw
hpresin[i]=sin(preycache)*0.5
hprecos[i]=cos(preycache)*0.5
prexs1cos[i]=cos(preycache*0.9009688679024191)
prexs2cos[i]=cos(preycache*0.6234898018587336)
prexs3cos[i]=cos(preycache*0.22252093395631445)}

var p,p2,p3,p4,p5,p6,i,co
var pc1,pc2,pc3,pc4,pc5,pc6
var ec1,ec2,ec3;
for( i=0;i<h;i++){
p=prodxf1[i];
p4=prodxs1[i]
pc1=preyfsin1cos[i];
pc2=preyfsin2cos[i];
pc3=preyfsin3cos[i];
pc4=preyfsin1sin[i];
pc5=preyfsin2sin[i];
pc6=preyfsin3sin[i];
for(co=0;co<w;co++){
ec1=prexs1cos[co]
ec2=prexs2cos[co]
ec3=prexs3cos[co]
p[co]=pc1*ec1+pc2*ec2+pc3*ec3+hprecos[co];
p4[co]=pc4*ec1+pc5*ec2+pc6*ec3+hpresin[co];;}
}


function redraw(){
var xf1,xs1,y=lvars[0],x=lvars[1],i=lvars[2],intload=wint[frame],xfracos=lvars[3]=fcos[frame],xfrasin=lvars[4]=fsin[frame++];
var r1=rs[0],r2=rs[1],r3=rs[2],r4=rs[3],r5=rs[4],r6=rs[5],r7=rs[6],r8=rs[7];
var n1=ns[0],n2=ns[1],n3=ns[2],n4=ns[3],n5=ns[4],n6=ns[5],n7=ns[6],n8=ns[7];
var temp1=temps[0],temp2=temps[1],temp3=temps[2],temp4=temps[3],temp5=temps[4],temp6=temps[5],temp7=temps[6],temp8=temps[7];

for(var y=0,i=0;y<h;y++){xf1=prodxf1[y];xs1=prodxs1[y];
for(x=0;x<w;x+=8) {
r1=3.5+xf1[x]*xfracos-xs1[x]*xfrasin
r2=3.5+xf1[x+1]*xfracos-xs1[x+1]*xfrasin
r3=3.5+xf1[x+2]*xfracos-xs1[x+2]*xfrasin
r4=3.5+xf1[x+3]*xfracos-xs1[x+3]*xfrasin
r5=3.5+xf1[x+4]*xfracos-xs1[x+4]*xfrasin
r6=3.5+xf1[x+5]*xfracos-xs1[x+5]*xfrasin
r7=3.5+xf1[x+6]*xfracos-xs1[x+6]*xfrasin
r8=3.5+xf1[x+7]*xfracos-xs1[x+7]*xfrasin
 temp1=(r1|0)
 temp2=(r2|0)
 temp3=(r3|0)
 temp4=(r4|0)
 temp5=(r5|0)
 temp6=(r6|0)
 temp7=(r7|0)
 temp8=(r8|0)
n1=(abs(temp1+(temp1&1)-r1)*0xff)
n2=(abs(temp2+(temp2&1)-r2)*0xff)
n3=(abs(temp3+(temp3&1)-r3)*0xff)
n4=(abs(temp4+(temp4&1)-r4)*0xff)
n5=(abs(temp5+(temp5&1)-r5)*0xff)
n6=(abs(temp6+(temp6&1)-r6)*0xff)
n7=(abs(temp7+(temp7&1)-r7)*0xff)
n8=(abs(temp8+(temp8&1)-r8)*0xff)
intload[i++]=(n1)|(n2<<8)|(n3<<16)|(n4<<24)
intload[i++]=(n5)|(n6<<8)|(n7<<16)|(n8<<24); }}}
while(frame<30)redraw();
var RGB=[],ic,ir,ig,ib;
for(var ic=0;ic<0xff;ic++){
ir=ic-31;ir*=ir>2;ig=ic-81;ig*=ig>8;ig=ig<<8;ib=(ic)<<16
RGB[ic]=(ir|ig|ib)|0xff000000;}
var dispc=[];
window.requestAnimationFrame=window.requestAnimationFrame ||    window.webkitRequestAnimationFrame    || window.mozRequestAnimationFrame    || window.oRequestAnimationFrame    || window.msRequestAnimationFrame;
function dispframe(){if(++frame >= 30)frame = 0;
if(!dispc[frame]){dispc[frame]={width:w,height:h,data:Uint8ClampedArray(ArrayBuffer(size))};
var tv=Uint32Array(dispc[frame].data.buffer);
var intpixels=Uint8Array(wint[frame].buffer);
for(var op=0,c=0;c<elsize;){tv[op++]=RGB[intpixels[c++]];}
delete(wint[frame]);}
context.putImageData(dispc[frame],0,0);
window.requestAnimationFrame(dispframe);}
addtm("ms render");dispframe();
</script></html>

Name: matth@eecs.berkeley.edu !!AjRHqD4qA0U7+RB 2011-11-09 22:27

>>294
No one cares. You failed at life. Go kill yourself you dumb nigger.

Name: Anonymous 2011-11-09 23:09

>>295
Just chill bro. It's FV posting in his own thread. Go bump an old thread with relevant advice if that makes you feel better.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 1:04

701ms
<html><head><style>html,body{width:100%;height:100%;margin:0px;}
</style></head><body><canvas id='c' ></canvas></body>
<script>//701ms current
var inittime=Date.now();var starttime=inittime;
function addtm(str){document.title+=Date.now()-starttime+str;starttime=Date.now()}
function settm(str){document.title=Date.now()-starttime+str;starttime=Date.now()}
function dump(a)document.writeln(a.toString())
var abs=Math.abs
var cos=Math.cos
var sin=Math.sin
var w=window.innerWidth
var h =window.innerHeight
w=w-w%8;//unroll factor
var halfantiw=w*0.0625;
var halfantih=h*0.0625;
var h8=h*8
var w8=w*8;
var canvas3=document.getElementById('c');
var context=canvas3.getContext("2d");
canvas3.width=window.innerWidth;
canvas3.height=window.innerHeight;
const size=w*h*4
var elsize=w*h;elsize+=(4-(elsize%4))
var wint=[];
for(i=0;i<30;i++){wint[i]=Uint32Array(ArrayBuffer(elsize));}
var frame = 0;
var i,preycache;
var rs=Float64Array(ArrayBuffer(64));
var ns=Float64Array(ArrayBuffer(64));
var temps=Int32Array(ArrayBuffer(32))
var lvars=Int32Array(ArrayBuffer(32))
var fcos=Float64Array(ArrayBuffer(8*30));
var fsin=Float64Array(ArrayBuffer(8*30));

var preyfsin1cos=Float64Array(ArrayBuffer(h8))
var preyfsin2cos=Float64Array(ArrayBuffer(h8))
var preyfsin3cos=Float64Array(ArrayBuffer(h8))
var preyfsin1sin=Float64Array(ArrayBuffer(h8))
var preyfsin2sin=Float64Array(ArrayBuffer(h8))
var preyfsin3sin=Float64Array(ArrayBuffer(h8))

var prexs1cos=Float64Array(ArrayBuffer(w8))
var prexs2cos=Float64Array(ArrayBuffer(w8))
var prexs3cos=Float64Array(ArrayBuffer(w8))
var hprecos=Float64Array(ArrayBuffer(w8))
var hpresin=Float64Array(ArrayBuffer(w8))
var prodxf1=Array(h)
var prodxs1=Array(h)
for( i=0;i<h;i++){
prodxf1[i]=Float64Array(ArrayBuffer(w8));
prodxs1[i]=Float64Array(ArrayBuffer(w8));
}


for(i=0;i<30;i++){
fcos[i]=cos(i*0.20943951023931953)
fsin[i]=sin(i*0.20943951023931953)
}

var pc1,pc2,pc3
for(i=0;i<h;i++){
preycache=i*0.125-halfantih;
pc1=preycache*0.4338837391175581
pc2=preycache*0.7818314824680298
pc3=preycache*0.9749279121818236
preyfsin1cos[i]=cos(pc1)
preyfsin1sin[i]=sin(pc1)
preyfsin2cos[i]=cos(pc2)
preyfsin2sin[i]=sin(pc2)
preyfsin3cos[i]=cos(pc3)
preyfsin3sin[i]=sin(pc3)
}



for(i=0;i<w;i++){
preycache=i*0.125 - halfantiw
hpresin[i]=sin(preycache)*0.5
hprecos[i]=cos(preycache)*0.5
prexs1cos[i]=cos(preycache*0.9009688679024191)
prexs2cos[i]=cos(preycache*0.6234898018587336)
prexs3cos[i]=cos(preycache*0.22252093395631445)}

var p,p2,p3,p4,p5,p6,i,co
var pc1,pc2,pc3,pc4,pc5,pc6
var ec1,ec2,ec3;
for( i=0;i<h;i++){
p=prodxf1[i];
p4=prodxs1[i]
pc1=preyfsin1cos[i];
pc2=preyfsin2cos[i];
pc3=preyfsin3cos[i];
pc4=preyfsin1sin[i];
pc5=preyfsin2sin[i];
pc6=preyfsin3sin[i];
for(co=0;co<w;co++){
ec1=prexs1cos[co]
ec2=prexs2cos[co]
ec3=prexs3cos[co]
p[co]=pc1*ec1+pc2*ec2+pc3*ec3+hprecos[co];
p4[co]=pc4*ec1+pc5*ec2+pc6*ec3+hpresin[co];;}
}


function redraw(){
var xf1,xs1,y=lvars[0],x=lvars[1],i=lvars[2],intload=wint[frame],xfracos=lvars[3]=fcos[frame],xfrasin=lvars[4]=fsin[frame];
var r1=rs[0],r2=rs[1],r3=rs[2],r4=rs[3],r5=rs[4],r6=rs[5],r7=rs[6],r8=rs[7];
var n1=ns[0],n2=ns[1],n3=ns[2],n4=ns[3],n5=ns[4],n6=ns[5],n7=ns[6],n8=ns[7];
var temp1=temps[0],temp2=temps[1],temp3=temps[2],temp4=temps[3],temp5=temps[4],temp6=temps[5],temp7=temps[6],temp8=temps[7];

for(var y=0,i=0;y<h;y++){xf1=prodxf1[y];xs1=prodxs1[y];
for(x=0;x<w;) {
r1=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
;r2=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
;r3=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
;r4=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
;r5=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
;r6=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
;r7=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
;r8=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
 temp1=(r1|0)
 temp2=(r2|0)
 temp3=(r3|0)
 temp4=(r4|0)
 temp5=(r5|0)
 temp6=(r6|0)
 temp7=(r7|0)
 temp8=(r8|0)
n1=(abs(temp1+(temp1&1)-r1)*0xff)
n2=(abs(temp2+(temp2&1)-r2)*0xff)
n3=(abs(temp3+(temp3&1)-r3)*0xff)
n4=(abs(temp4+(temp4&1)-r4)*0xff)
n5=(abs(temp5+(temp5&1)-r5)*0xff)
n6=(abs(temp6+(temp6&1)-r6)*0xff)
n7=(abs(temp7+(temp7&1)-r7)*0xff)
n8=(abs(temp8+(temp8&1)-r8)*0xff)
intload[i++]=(n1)|(n2<<8)|(n3<<16)|(n4<<24)
intload[i++]=(n5)|(n6<<8)|(n7<<16)|(n8<<24); }}}
for(frame=0;frame<30;frame++)redraw();
var RGB=[],ic,ir,ig,ib;
for(var ic=0;ic<0xff;ic++){
ir=ic-31;ir*=ir>2;ig=ic-81;ig*=ig>8;ig=ig<<8;ib=(ic)<<16
RGB[ic]=(ir|ig|ib)|0xff000000;}
var dispc=[];
window.requestAnimationFrame=window.requestAnimationFrame ||    window.webkitRequestAnimationFrame    || window.mozRequestAnimationFrame    || window.oRequestAnimationFrame    || window.msRequestAnimationFrame;
function dispframe(){if(++frame >= 30)frame = 0;
if(!dispc[frame]){dispc[frame]={width:w,height:h,data:Uint8ClampedArray(ArrayBuffer(size))};
var tv=Uint32Array(dispc[frame].data.buffer);
var intpixels=Uint8Array(wint[frame].buffer);
for(var op=0,c=0;c<elsize;){tv[op++]=RGB[intpixels[c++]];}
delete(wint[frame]);}
context.putImageData(dispc[frame],0,0);
window.requestAnimationFrame(dispframe);}
addtm("ms render");dispframe();
</script></html>

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 1:43

681ms
    <html><head><style>html,body{width:100%;height:100%;margin:0px;}
    </style></head><body><canvas id='c' ></canvas></body>
    <script>//701ms current
    var inittime=Date.now();var starttime=inittime;
    function addtm(str){document.title+=Date.now()-starttime+str;starttime=Date.now()}
    function settm(str){document.title=Date.now()-starttime+str;starttime=Date.now()}
    function dump(a)document.writeln(a.toString())
    var abs=Math.abs
    var cos=Math.cos
    var sin=Math.sin
    var w=window.innerWidth
    var h =window.innerHeight
    w=w-w%8;//unroll factor
    var halfantiw=w*0.0625;
    var halfantih=h*0.0625;
    var h8=h*8
    var w8=w*8;
    var canvas3=document.getElementById('c');
    var context=canvas3.getContext("2d");
    canvas3.width=window.innerWidth;
    canvas3.height=window.innerHeight;
    const size=w*h*4
    var elsize=w*h;elsize+=(4-(elsize%4))
    var wint=[];
    for(i=0;i<30;i++){wint[i]=Uint32Array(ArrayBuffer(elsize));}
    var frame = 0;
    var i,preycache;
    var rs=Float64Array(ArrayBuffer(64));
    var ns=Float64Array(ArrayBuffer(64));
    var temps=Int32Array(ArrayBuffer(64))
    var lvars=Int32Array(ArrayBuffer(32))
    var fcos=Float64Array(ArrayBuffer(8*30));
    var fsin=Float64Array(ArrayBuffer(8*30));

    var preyfsin1cos=Float64Array(ArrayBuffer(h8))
    var preyfsin2cos=Float64Array(ArrayBuffer(h8))
    var preyfsin3cos=Float64Array(ArrayBuffer(h8))
    var preyfsin1sin=Float64Array(ArrayBuffer(h8))
    var preyfsin2sin=Float64Array(ArrayBuffer(h8))
    var preyfsin3sin=Float64Array(ArrayBuffer(h8))

    var prexs1cos=Float64Array(ArrayBuffer(w8))
    var prexs2cos=Float64Array(ArrayBuffer(w8))
    var prexs3cos=Float64Array(ArrayBuffer(w8))
    var hprecos=Float64Array(ArrayBuffer(w8))
    var hpresin=Float64Array(ArrayBuffer(w8))
    var prodxf1=Array(h)
    var prodxs1=Array(h)
    for( i=0;i<h;i++){
    prodxf1[i]=Float64Array(ArrayBuffer(w8));
    prodxs1[i]=Float64Array(ArrayBuffer(w8));
    }


    for(i=0;i<30;i++){
    fcos[i]=cos(i*0.20943951023931953)
    fsin[i]=sin(i*0.20943951023931953)
    }

    var pc1,pc2,pc3
    for(i=0;i<h;i++){
    preycache=i*0.125-halfantih;
    pc1=preycache*0.4338837391175581
    pc2=preycache*0.7818314824680298
    pc3=preycache*0.9749279121818236
    preyfsin1cos[i]=cos(pc1)
    preyfsin1sin[i]=sin(pc1)
    preyfsin2cos[i]=cos(pc2)
    preyfsin2sin[i]=sin(pc2)
    preyfsin3cos[i]=cos(pc3)
    preyfsin3sin[i]=sin(pc3)
    }



    for(i=0;i<w;i++){
    preycache=i*0.125 - halfantiw
    hpresin[i]=sin(preycache)*0.5
    hprecos[i]=cos(preycache)*0.5
    prexs1cos[i]=cos(preycache*0.9009688679024191)
    prexs2cos[i]=cos(preycache*0.6234898018587336)
    prexs3cos[i]=cos(preycache*0.22252093395631445)}

    var p,p2,p3,p4,p5,p6,i,co
    var pc1,pc2,pc3,pc4,pc5,pc6
    var ec1,ec2,ec3;
    for( i=0;i<h;i++){
    p=prodxf1[i];
    p4=prodxs1[i]
    pc1=preyfsin1cos[i];
    pc2=preyfsin2cos[i];
    pc3=preyfsin3cos[i];
    pc4=preyfsin1sin[i];
    pc5=preyfsin2sin[i];
    pc6=preyfsin3sin[i];
    for(co=0;co<w;co++){
    ec1=prexs1cos[co]
    ec2=prexs2cos[co]
    ec3=prexs3cos[co]
    p[co]=pc1*ec1+pc2*ec2+pc3*ec3+hprecos[co];
    p4[co]=pc4*ec1+pc5*ec2+pc6*ec3+hpresin[co];;}
    }


    function redraw(){
    var xf1,xs1,y=lvars[0],x=lvars[1],i=lvars[2],intload=wint[frame],xfracos=lvars[3]=fcos[frame],xfrasin=lvars[4]=fsin[frame];
    var r1=rs[0],r2=rs[1],r3=rs[2],r4=rs[3],r5=rs[4],r6=rs[5],r7=rs[6],r8=rs[7];
    var n1=ns[0],n2=ns[1],n3=ns[2],n4=ns[3],n5=ns[4],n6=ns[5],n7=ns[6],n8=ns[7];
    var temp1=temps[0],temp2=temps[1],temp3=temps[2],temp4=temps[3],temp5=temps[4],temp6=temps[5],temp7=temps[6],temp8=temps[7],t1=temps[8],t2=temps[9],t3=temps[10],t4=temps[11],t5=temps[12],t6=temps[13],t7=temps[14],t8=temps[15];;

    for(var y=0,i=0;y<h;y++){xf1=prodxf1[y];xs1=prodxs1[y];
    for(x=0;x<w;) {
    r1=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r2=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r3=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r4=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r5=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r6=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r7=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r8=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
     temp1=(r1|0)
     temp2=(r2|0)
     temp3=(r3|0)
     temp4=(r4|0)
     temp5=(r5|0)
     temp6=(r6|0)
     temp7=(r7|0)
     temp8=(r8|0)
  t1=(temp1&1)+temp1-r1
  t2=(temp2&1)+temp2-r2
  t3=(temp3&1)+temp3-r3
  t4=(temp4&1)+temp4-r4
  t5=(temp5&1)+temp5-r5
  t6=(temp6&1)+temp6-r6
  t7=(temp7&1)+temp7-r7
  t8=(temp8&1)+temp8-r8
 
    n1=(abs(t1)*0xff)
    n2=(abs(t2)*0xff)
    n3=(abs(t3)*0xff)
    n4=(abs(t4)*0xff)
    n5=(abs(t5)*0xff)
    n6=(abs(t6)*0xff)
    n7=(abs(t7)*0xff)
    n8=(abs(t8)*0xff)
    intload[i++]=(n1)|(n2<<8)|(n3<<16)|(n4<<24)
    intload[i++]=(n5)|(n6<<8)|(n7<<16)|(n8<<24); }}}
    for(frame=0;frame<30;frame++)redraw();
    var RGB=[],ic,ir,ig,ib;
    for(var ic=0;ic<0xff;ic++){
    ir=ic-31;ir*=ir>2;ig=ic-81;ig*=ig>8;ig=ig<<8;ib=(ic)<<16
    RGB[ic]=(ir|ig|ib)|0xff000000;}
    var dispc=[];
    window.requestAnimationFrame=window.requestAnimationFrame ||    window.webkitRequestAnimationFrame    || window.mozRequestAnimationFrame    || window.oRequestAnimationFrame    || window.msRequestAnimationFrame;
    function dispframe(){if(++frame >= 30)frame = 0;
    if(!dispc[frame]){dispc[frame]={width:w,height:h,data:Uint8ClampedArray(ArrayBuffer(size))};
    var tv=Uint32Array(dispc[frame].data.buffer);
    var intpixels=Uint8Array(wint[frame].buffer);
    for(var op=0,c=0;c<elsize;){tv[op++]=RGB[intpixels[c++]];}
    delete(wint[frame]);}
    context.putImageData(dispc[frame],0,0);
    window.requestAnimationFrame(dispframe);}
    addtm("ms render");dispframe();
    </script></html>

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 2:49

666ms
   <html><head><style>html,body{width:100%;height:100%;margin:0px;}
    </style></head><body><canvas id='c' ></canvas></body>
    <script>//676ms current
    var inittime=Date.now();var starttime=inittime;
    function addtm(str){document.title+=Date.now()-starttime+str;starttime=Date.now()}
    function settm(str){document.title=Date.now()-starttime+str;starttime=Date.now()}
    function dump(a)document.writeln(a.toString())
    var abs=Math.abs
    var cos=Math.cos
    var sin=Math.sin
    var w=window.innerWidth
    var h =window.innerHeight
    w=w-w%8;//unroll factor
    var halfantiw=w*0.0625;
    var halfantih=h*0.0625;
    var h8=h*8
    var w8=w*8;
    var canvas3=document.getElementById('c');
    var context=canvas3.getContext("2d");
    canvas3.width=window.innerWidth;
    canvas3.height=window.innerHeight;
    const size=w*h*4
    var elsize=w*h;elsize+=(4-(elsize%4))
    var wint=[];
    for(i=0;i<30;i++){wint[i]=Uint32Array(ArrayBuffer(elsize));}
    var frame = 0;
    var i,preycache;
    var rs=Float64Array(ArrayBuffer(128));
   
    var temps=Int32Array(ArrayBuffer(64))
    var lvars=Int32Array(ArrayBuffer(32))
    var fcos=Float64Array(ArrayBuffer(8*30));
    var fsin=Float64Array(ArrayBuffer(8*30));

    var preyfsin1cos=Float64Array(ArrayBuffer(h8))
    var preyfsin2cos=Float64Array(ArrayBuffer(h8))
    var preyfsin3cos=Float64Array(ArrayBuffer(h8))
    var preyfsin1sin=Float64Array(ArrayBuffer(h8))
    var preyfsin2sin=Float64Array(ArrayBuffer(h8))
    var preyfsin3sin=Float64Array(ArrayBuffer(h8))

    var prexs1cos=Float64Array(ArrayBuffer(w8))
    var prexs2cos=Float64Array(ArrayBuffer(w8))
    var prexs3cos=Float64Array(ArrayBuffer(w8))
    var hprecos=Float64Array(ArrayBuffer(w8))
    var hpresin=Float64Array(ArrayBuffer(w8))
    var prodxf1=Array(h)
    var prodxs1=Array(h)
    for( i=0;i<h;i++){
    prodxf1[i]=Float64Array(ArrayBuffer(w8));
    prodxs1[i]=Float64Array(ArrayBuffer(w8));
    }


    for(i=0;i<30;i++){
    fcos[i]=cos(i*0.20943951023931953)
    fsin[i]=sin(i*0.20943951023931953)
    }

    var pc1,pc2,pc3
    for(i=0;i<h;i++){
    preycache=i*0.125-halfantih;
    pc1=preycache*0.4338837391175581
    pc2=preycache*0.7818314824680298
    pc3=preycache*0.9749279121818236
    preyfsin1cos[i]=cos(pc1)
    preyfsin1sin[i]=sin(pc1)
    preyfsin2cos[i]=cos(pc2)
    preyfsin2sin[i]=sin(pc2)
    preyfsin3cos[i]=cos(pc3)
    preyfsin3sin[i]=sin(pc3)
    }



    for(i=0;i<w;i++){
    preycache=i*0.125 - halfantiw
    hpresin[i]=sin(preycache)*0.5
    hprecos[i]=cos(preycache)*0.5
    prexs1cos[i]=cos(preycache*0.9009688679024191)
    prexs2cos[i]=cos(preycache*0.6234898018587336)
    prexs3cos[i]=cos(preycache*0.22252093395631445)}

function spfl(){
    var p,p2,p3,p4,p5,p6,i,co
    var pc1,pc2,pc3,pc4,pc5,pc6
    var ec1,ec2,ec3;
    for( i=0;i<h;i++){
    p=prodxf1[i];
    p4=prodxs1[i]
    pc1=preyfsin1cos[i];
    pc2=preyfsin2cos[i];
    pc3=preyfsin3cos[i];
    pc4=preyfsin1sin[i];
    pc5=preyfsin2sin[i];
    pc6=preyfsin3sin[i];
    for(co=0;co<w;co++){
    ec1=prexs1cos[co]
    ec2=prexs2cos[co]
    ec3=prexs3cos[co]
    p[co]=pc1*ec1+pc2*ec2+pc3*ec3+hprecos[co];
    p4[co]=pc4*ec1+pc5*ec2+pc6*ec3+hpresin[co];}
    }}spfl();


    function redraw(){
    var xf1,xs1,y=lvars[0],x=lvars[1],i=lvars[2],intload=wint[frame],xfracos=lvars[3]=fcos[frame],xfrasin=lvars[4]=fsin[frame];
    var r1=rs[0],r2=rs[1],r3=rs[2],r4=rs[3],r5=rs[4],r6=rs[5],r7=rs[6],r8=rs[7];
    var n1=rs[8],n2=rs[9],n3=rs[10],n4=rs[11],n5=rs[12],n6=rs[13],n7=rs[14],n8=rs[15];
    var temp1=temps[0],temp2=temps[1],temp3=temps[2],temp4=temps[3],temp5=temps[4],temp6=temps[5],temp7=temps[6],temp8=temps[7],t1=temps[8],t2=temps[9],t3=temps[10],t4=temps[11],t5=temps[12],t6=temps[13],t7=temps[14],t8=temps[15];;

    for(var y=0,i=0;y<h;y++){xf1=prodxf1[y];xs1=prodxs1[y];
    for(x=0;x<w;) {
    r1=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r2=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r3=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r4=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r5=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r6=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r7=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r8=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
     temp1=(r1|0)
     temp2=(r2|0)
     temp3=(r3|0)
     temp4=(r4|0)
     temp5=(r5|0)
     temp6=(r6|0)
     temp7=(r7|0)
     temp8=(r8|0)
  t1=(temp1&1)+temp1-r1
  t2=(temp2&1)+temp2-r2
  t3=(temp3&1)+temp3-r3
  t4=(temp4&1)+temp4-r4
  t5=(temp5&1)+temp5-r5
  t6=(temp6&1)+temp6-r6
  t7=(temp7&1)+temp7-r7
  t8=(temp8&1)+temp8-r8
 
    n1=(abs(t1)*0xff)
    n2=(abs(t2)*0xff)
    n3=(abs(t3)*0xff)
    n4=(abs(t4)*0xff)
    n5=(abs(t5)*0xff)
    n6=(abs(t6)*0xff)
    n7=(abs(t7)*0xff)
    n8=(abs(t8)*0xff)
    intload[i++]=(n1)|(n2<<8)|(n3<<16)|(n4<<24)
    intload[i++]=(n5)|(n6<<8)|(n7<<16)|(n8<<24); }}}
    for(frame=0;frame<30;frame++)redraw();

var RGB=[],ic,ir,ig,ib;
    for(var ic=0;ic<0xff;ic++){
    ir=ic-31;ir*=ir>2;ig=ic-81;ig*=ig>8;ig=ig<<8;ib=(ic)<<16
    RGB[ic]=ir|ig|ib|0xff000000;}
    var dispc=[];

    function dispframe(){
  if(!window.requestAnimationFrame){  window.requestAnimationFrame=window.requestAnimationFrame ||    window.webkitRequestAnimationFrame    || window.mozRequestAnimationFrame    || window.oRequestAnimationFrame    || window.msRequestAnimationFrame;}
if(++frame >= 30)frame = 0;
    if(!dispc[frame]){dispc[frame]={width:w,height:h,data:Uint8ClampedArray(ArrayBuffer(size))};
    var tv=Uint32Array(dispc[frame].data.buffer);
    var intpixels=Uint8Array(wint[frame].buffer);
    for(var op=0,c=0;c<elsize;){tv[op++]=RGB[intpixels[c++]];}
    delete(wint[frame]);}
    context.putImageData(dispc[frame],0,0);
    window.requestAnimationFrame(dispframe);}
    addtm("ms render")    ;dispframe();
    </script></html>

Name: Anonymous 2011-11-10 4:31

Still way way too slow.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 4:43

661ms merge spfl+redraw
<html><head><style>html,body{width:100%;height:100%;margin:0px;}
    </style></head><body><canvas id='c' ></canvas></body>
    <script>//663ms current
    var inittime=Date.now();var starttime=inittime;
    function addtm(str){document.title+=Date.now()-starttime+str;starttime=Date.now()}
    function settm(str){document.title=Date.now()-starttime+str;starttime=Date.now()}
    function dump(a)document.writeln(a.toString())
    var abs=Math.abs
    var cos=Math.cos
    var sin=Math.sin
    var w=window.innerWidth
    var h =window.innerHeight
    w=w-w%8;//unroll factor


    var h8=h*8
    var w8=w*8;
    var canvas3=document.getElementById('c');
    var context=canvas3.getContext("2d");
    canvas3.width=window.innerWidth;
    canvas3.height=window.innerHeight;
    const size=w*h*4
    var elsize=w*h;elsize+=(4-(elsize%4))
    var wint=[];
    for(i=0;i<30;i++){wint[i]=Uint32Array(ArrayBuffer(elsize));}
    var frame = 0;
    var i,preycache;

       var locvar=Float64Array(ArrayBuffer(128));


    var fcos=Float64Array(ArrayBuffer(8*30));
    var fsin=Float64Array(ArrayBuffer(8*30));

    var preyfsin1cos=Float64Array(ArrayBuffer(h8))
    var preyfsin2cos=Float64Array(ArrayBuffer(h8))
    var preyfsin3cos=Float64Array(ArrayBuffer(h8))
    var preyfsin1sin=Float64Array(ArrayBuffer(h8))
    var preyfsin2sin=Float64Array(ArrayBuffer(h8))
    var preyfsin3sin=Float64Array(ArrayBuffer(h8))

    var prexs1cos=Float64Array(ArrayBuffer(w8))
    var prexs2cos=Float64Array(ArrayBuffer(w8))
    var prexs3cos=Float64Array(ArrayBuffer(w8))
    var hprecos=Float64Array(ArrayBuffer(w8))
    var hpresin=Float64Array(ArrayBuffer(w8))
 




function preyfill(){
    for(i=0;i<30;i++){
    fcos[i]=cos(i*0.20943951023931953)
    fsin[i]=sin(i*0.20943951023931953)
    }
    var pc1,pc2,pc3,halfantih=h*0.0625;
    for(i=0;i<h;i++){  
    preycache=i*0.125-halfantih;
    pc1=preycache*0.4338837391175581
    pc2=preycache*0.7818314824680298
    pc3=preycache*0.9749279121818236
    preyfsin1cos[i]=cos(pc1)
    preyfsin1sin[i]=sin(pc1)
    preyfsin2cos[i]=cos(pc2)
    preyfsin2sin[i]=sin(pc2)
    preyfsin3cos[i]=cos(pc3)
    preyfsin3sin[i]=sin(pc3)
    }
}preyfill();

function prexfill(){var preycache=locvar[0];
    var halfantiw=w*0.0625;
    for(i=0;i<w;i++){
    preycache=i*0.125 - halfantiw
    hpresin[i]=sin(preycache)*0.5
    hprecos[i]=cos(preycache)*0.5
    prexs1cos[i]=cos(preycache*0.9009688679024191)
    prexs2cos[i]=cos(preycache*0.6234898018587336)
    prexs3cos[i]=cos(preycache*0.22252093395631445)}}
prexfill()
    var rs=Float64Array(ArrayBuffer(128));
    var temps=Int32Array(ArrayBuffer(64))
    var lvars=Int32Array(ArrayBuffer(32))
 
   var prodxf1=Array(h)
    var prodxs1=Array(h)
    for( i=0;i<h;i++){
    prodxf1[i]=Float64Array(ArrayBuffer(w8));
    prodxs1[i]=Float64Array(ArrayBuffer(w8));
    }

    function redraw(){
    var p,p2,p3,p4,p5,p6,i,co
    var pc1,pc2,pc3,pc4,pc5,pc6
    var ec1,ec2,ec3;
    for( i=0;i<h;i++){
    p=prodxf1[i];
    p4=prodxs1[i]
    pc1=preyfsin1cos[i];
    pc2=preyfsin2cos[i];
    pc3=preyfsin3cos[i];
    pc4=preyfsin1sin[i];
    pc5=preyfsin2sin[i];
    pc6=preyfsin3sin[i];
    for(co=0;co<w;co++){
    ec1=prexs1cos[co]
    ec2=prexs2cos[co]
    ec3=prexs3cos[co]
    p[co]=pc1*ec1+pc2*ec2+pc3*ec3+hprecos[co];
    p4[co]=pc4*ec1+pc5*ec2+pc6*ec3+hpresin[co];}
    }

var r1=rs[0],r2=rs[1],r3=rs[2],r4=rs[3],r5=rs[4],r6=rs[5],r7=rs[6],r8=rs[7];
    var n1=rs[8],n2=rs[9],n3=rs[10],n4=rs[11],n5=rs[12],n6=rs[13],n7=rs[14],n8=rs[15];
    var temp1=temps[0],temp2=temps[1],temp3=temps[2],temp4=temps[3],temp5=temps[4],temp6=temps[5],temp7=temps[6],temp8=temps[7],t1=temps[8],t2=temps[9],t3=temps[10],t4=temps[11],t5=temps[12],t6=temps[13],t7=temps[14],t8=temps[15];;
   var xf1,xs1,y=lvars[0],x=lvars[1],i=lvars[2];
    for(var frame=0;frame<30;frame++){
 var intload=wint[frame],xfracos=lvars[3]=fcos[frame],xfrasin=lvars[4]=fsin[frame];


    for(y=0,i=0;y<h;y++){xf1=prodxf1[y];xs1=prodxs1[y];
    x=0;while(x<w) {
    r1=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r2=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r3=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r4=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r5=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r6=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r7=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
    ;r8=3.5+xf1[x]*xfracos-xs1[x++]*xfrasin
     temp1=(r1|0)
     temp2=(r2|0)
     temp3=(r3|0)
     temp4=(r4|0)
     temp5=(r5|0)
     temp6=(r6|0)
     temp7=(r7|0)
     temp8=(r8|0)
  t1=(temp1&1)+temp1-r1
  t2=(temp2&1)+temp2-r2
  t3=(temp3&1)+temp3-r3
  t4=(temp4&1)+temp4-r4
  t5=(temp5&1)+temp5-r5
  t6=(temp6&1)+temp6-r6
  t7=(temp7&1)+temp7-r7
  t8=(temp8&1)+temp8-r8
 
    n1=(abs(t1)*0xff)
    n2=(abs(t2)*0xff)
    n3=(abs(t3)*0xff)
    n4=(abs(t4)*0xff)
    n5=(abs(t5)*0xff)
    n6=(abs(t6)*0xff)
    n7=(abs(t7)*0xff)
    n8=(abs(t8)*0xff)
    intload[i++]=(n1)|(n2<<8)|(n3<<16)|(n4<<24)
    intload[i++]=(n5)|(n6<<8)|(n7<<16)|(n8<<24); }}}}
redraw();
var RGB=[],dispc=[];
function palgen(){
var ic,ir,ig,ib;
    for(var ic=0;ic<0xff;ic++){
    ir=ic-31;ir*=ir>2;ig=ic-81;ig*=ig>8;ig=ig<<8;ib=(ic)<<16
    RGB[ic]=ir|ig|ib|0xff000000;}}palgen();
    addtm("ms render")
    function dispframe(){
  if(!window.requestAnimationFrame){  window.requestAnimationFrame=window.requestAnimationFrame ||    window.webkitRequestAnimationFrame    || window.mozRequestAnimationFrame    || window.oRequestAnimationFrame    || window.msRequestAnimationFrame;}
if(++frame >= 30)frame = 0;
    if(!dispc[frame]){dispc[frame]={width:w,height:h,data:Uint8ClampedArray(ArrayBuffer(size))};
    var tv=Uint32Array(dispc[frame].data.buffer);
    var intpixels=Uint8Array(wint[frame].buffer);
    for(var op=0,c=0;c<elsize;){tv[op++]=RGB[intpixels[c++]];}
    delete(wint[frame]);};
    context.putImageData(dispc[frame],0,0);
    window.requestAnimationFrame(dispframe);}dispframe();

    </script></html>

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 4:44

>>300
72 times faster than original quasicrystal code. And i think thats not the ultimate limit,could be possible to get within half a second

Name: Anonymous 2011-11-10 7:19

>>257
For a second I thought someone had finally broken out the Asm and pwned everyone else.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 7:34

>>303
I have a habit for checking asm output of compiler to check if they make some part of code(like inner loops) calling slow opcode like    
fnstcw

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 22:45

http://pastebin.com/hqy7mvzC version with multifill

Name: Cudder !MhMRSATORI!FBeUS42x4uM+kgp 2011-11-11 5:13

>>303,304
You're tempting me to refresh my demoscene skills and try to write this in 256 bytes.

http://www.pouet.net/prod.php?which=3397

Name: Anonymous 2012-06-18 21:22

Interesting

Name: Anonymous 2012-06-19 11:53

灠╀栩茆➕锠⦘蕑ኇ镹䜙ᒘቨ蔐酧甒ㄲ桸劘慓ͤ灉䢉嚕占ч爧Ćᐢᥲ॥昘ᚖ疁捉锔牘䈗瑑ㄲƄ馂։儵䄣餙ङ椉䤓ᒅ枈炁腢䞙堰癳坙ॄፓ靆॑င匳唐敀捦┉ᤱᥦ㜃蝨ㅉ撓遰眥䙠ᡗ昱錴蔘疂㐩奉瑱瘄焵䤴琧蝰椹ސ䠢–祲喐睲"✉搉爢〶桘ओڔȳ靅恲ࡹ眥蘩劑坱嘶唦昡薇㒑呴偆舉袄☡荁ɹ奒䀨㤵㔙阅皉ृ襷銂敹衦㤨礶ȕ偦垇概ᡱ癉礣ᙔ酱㤙䔵–焸堰树゘癠褨ͩ┥脧銗朄ࡀ銀०摨鍷逷瘹瀁䚖⊔晔ᖉ㈰≖焢䌇蝲⅘顰戕䔴ŗ鐂蕢х奸㡥∇逃喅镐ㅶ݉㑠獒℘ᤖ䤡鐠㌱݂䙄瀴暙ऱ眘镳㝩阐鈱⚔瞆莙焴⁤␔䀹㔸鐵ᤶ敡Ĥ戗堡劔靰ㄲ剃̤㘑癢聆煲垄ᠴ畣暅牱鎐ॗ恆蕳့蝦䀢᎘树䔱砉⎆♅ᙩ蕹₆ሤ厉ᘸ刷䈤褓杢̉垃㙰醙ኘ隓朔Ⅲ故㤐Ȩㄹ领㎔ᅆ䕑ɕ挗十蠳耐憀㜠‹夡កᑙ猓晲阷艷䄥⠶⍔煈嚐耹味䍩

Name: Anonymous 2012-06-19 12:14

䠄斓錈晙梘㠡獦坄戔̧╰陔垖冒桂ᙵࡑ靂✄ၨᙕ㦂蕙ぐ眩㌦䚆恃ဃ扄ᎆ薁ݹ防䆈ᤠ䕆鄨䍘錓葁♇㘁ሑ䜙␇₅煵ᑀ梑〃錹怡ᖂ襱蕓䢓䙑㜵ጨፖᐠ脅㈇灨⎗ࡀ7ℳᝒ怹皅ᔘ霤虡⌔⌈㥃⤆匉愄㍔Ձܘ䕅挹桤葲㔲褀耄ㅅ䀧⍠颇ᢈ鈨ɶ脴䁅呵В鄅葕ℑ戕蒁杅鎖袅ቹሤ䞈❴鑐䜓吁ጲ̈鍉"慧剘䢘✖㑨頁顅ᤓℂၦㅦ䉈怘⑰㦙愶唵甉化፴遉玖扑䜩妐܅醔栁䉳፦ܨ∳瑢蠷䄹A嘕✙䚀蚕恀ᢓ愄熉饘呑甅䄹࠳ऐᅀ䍇饃⎖蜄⑨蠃स敇顀࠸焹茠䘓荧捗瘗昸դ酢㐧牲ऩ畩薓圳隁ᕉ硖唅覕祣ᦂ阶०䔘晀瘙लٔ儰̆ᔧ圹鉳⡂䉢ቆ㌄癣墕䠵錧耉ᤧ⚑䐕ᘉ焗邈陷䀣ᒁ蜁䑘畃ᐠ㉒㠀㥦易✆䈁匘灒ᤠ頁噘䊐℈奱茲地䦆ᝳ鑩栀陲≨ᕇ␥鄁䆉镵〳吃䌅恘ܱ杹Ѡ銆ी兲䥹锘睗畗㥥鉥ܷᤠ鎔䄖∁吆覐椑饉⌐ȶ隓ቸ䘵☣ㄔ㑈熙

Name: Anonymous 2012-06-19 14:49

C++ is a good language. It is not a perfect language because it inherits from C. C is a flawed language where many things are left undefined. C is an ancient artifact that serves no purpose outside of the domain of kernel design. Because of the improvements made upon C to form C++, beginning programmers and veteran programmers alike may be led astray, thinking that modern C usage is a good idea. It is a mistake to believe the success of C++ justifies the continued use and popularity of C. Just because C++ is successful does not mean the language it has inherited from is of high quality.

Name: Anonymous 2012-07-22 14:19

So FrozenVoid and Cudderspace, it's been 7 months, how was the wedding?

Name: Anonymous 2013-08-31 19:43


 Ruitomo? Killing curse that's not unique to you is good enough.

Name: Anonymous 2013-08-31 21:14


How are little girls disgusting? If that's not it, how is a grown man masturbating to little girls any more disgusting than another grown man masturbating to women?

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