3 ms·
Coming from the compiler side of things, you're sacrificing in usability to make it possible for the JIT compiler to optimize the code further. If you allocate
by rinon 12y ago
Coming from the compiler side of things, you're sacrificing in usability to make it possible for the JIT compiler to optimize the code further. If you allocate all memory ahead-of-time, the GC never needs to operate on that region, which gives you substantial performance improvements.
This is definitely a trade-off, but it's my understanding that asm.js makes more sense as a target for compilers to emit code for, rather than for hand-writing. Would you hand write an entire application in x86 assembly? Probably not...
- CJefferson 12y agoCouldn't the JIT provide me a way of allocating new blocks of memory? and freeing blocks of memory back to the 'OS'? At least allocating new blocks? I don't mind no GC, but having to allocate the maximum memory your program will use before it starts can be painful.