You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • I'm not really sure what the plan is with cmd: new Uint8Array?

    I think really the goal is to ensure that the minimizer can actually totally inline the constants and then remove C altogether, so a Uint8Array may not help.

    Having extra constants doesn't matter at all as long as they can get minimized away, in fact it's probably handy for people later on.

    I think the Writing Modules and Performance pages are about all there is right now. To be honest the code you had already looks really good.

    Things that'd make it a bit more efficient...

    • Change sendCommandAndData to something with a short name, like scd - it's public so the name won't get changed, so the smaller it is the smaller the final code will be.
    • There's no need to return; at the end of functions, you can just ditch that
    • The var C thing
    • Make lutRegisterData a Uint8Array and define it outside the function - that'll make a big difference to memory usage.
    • If it's possible to use an arraybuffer Graphics instance, that'll be so much quicker than the callback one. It looks like a 2 bit instance would work fine - if the bytes are the wrong order you can define msb like:

      Graphics.createCallback(
              this.C.DISPLAY_SIZE_X,
              this.C.DISPLAY_SIZE_Y,
              2, {msb:true});
      
About

Avatar for Gordon @Gordon started