closure-compiler icon indicating copy to clipboard operation
closure-compiler copied to clipboard

Transport asm.js correctly

Open shicks opened this issue 6 years ago • 4 comments

Peephole passes and others should not traverse into functions annotated with 'use asm'. The 'use asm' string needs to be retained.

shicks avatar Dec 05 '17 22:12 shicks

It seems rather strange to me, to use both asm.js and Closure Compiler on the same code. But I have heard that some people do it, so I guess we could do this.

MatrixFrog avatar Dec 06 '17 19:12 MatrixFrog

Is there any progress on this? Would be very nice to have asm.js in very hot functions without closure compiler ripping it apart into normal js code.

L3P3 avatar Feb 06 '22 13:02 L3P3

I have not much knowledge how closure-compiler works but I assume that it would be enough to just fall back to white-space only (and maybe variable renaming) inside of blocks that have "use-asm"; at their beginning. Is that somewhat easy to implement? I have code where hot loops were converted to asm code, like you would do it in c projects with inline assembly.

L3P3 avatar Jun 27 '22 18:06 L3P3

The "only" thing really needed is that a function with "use asm" at its beginning is just handled like a text, so that if not making it smaller, it is at least preserved 1:1 instead of loosing its performance gains...

L3P3 avatar Jun 27 '22 18:06 L3P3