• i am using the E.asm(...). it's a great tool to get things done (even when some thumb instructions are missing;).

    compilation is fine, but does not bring that boost as E.asm does - even when just using peek and poke. I implemented the same operation in 3 different ways, and called each 1000 times:

    // takes 538ms ... 222% of the fastest
    function rclr1(addr,mask){    
    	poke32( addr, peek32(addr) & ~mask);
    }
    
    // takes 334ms ... 138% of the fastest
    function rclr2(addr,mask){    
      "compiled";
    	poke32( addr, peek32(addr) & !mask); //  ~ not supported by compiler 
    }
    
    // takes 242ms
    var rclr3=E.asm("void(int,int)",
      "ldr r2,[r0]",
      "bic r2,r1",
      "str r2,[r0]",
      "bx lr"
    );
    

    i took a look on the compiler output - the differnces in code between rclr2 and rclr3 speak for themselves:

    var rclr2=E.nativeCall(1, "JsVar(JsVar,JsVar)", atob("LenwT4ewBq1F+AgNB0Y0SCpLeESJRphHKU­6CRrBHASMAkwAjGkYZRgGVJkyDRqBHgEYlTFhGoE­dQRqBHQEawRyJLgkZIRphHgPABACBLwLKYRyBLAU­aDRiYiUEaYRx5KA5CQRx1KkEeBRgObGEagR1hGoE­dQRqBHQEagRxlIBJcOS834FJB4RJhHB0awRwIjAJ­MAIxpGGUYBlQpNBkaoRwVGMEagRzhGoEdIRqBHKE­agRwAgB7C96PCPAL+1hgMA0aYCAPFQAgDldAUAIa­wCAHV2BQCLKwIAiZgCAIV2BQDSAAAAZQAAAHBlZW­szMgBwb2tlMzIAAAA="));
    
    var rclr3=E.nativeCall(1, "void(int,int)", atob("AmiKQwJgcEc="))
    

    ps: seems that the unary '~' operator has been forgotten in the compiler

About

Avatar for mrQ @mrQ started