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: 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

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