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

Acid - final release

Name: FrozenVoid 2011-10-28 11:50

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

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

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