3 ms·
> if you perform a sort of pre-compilation pass to generate a sort of bytecode Generate JS and throw it through eval/new Function. The JS engine is going to be
by chmod775 3y ago
> if you perform a sort of pre-compilation pass to generate a sort of bytecode
Generate JS and throw it through eval/new Function. The JS engine is going to beat by a mile whatever you can come up with within the constraints of JS.
- Lerc 3y agoThat's more or less what I did with C50. I wrote a simple translator to turn the stack based code into JavaScript expressions, then created a function via new Function. It came out a couple of orders of magnitude faster than the interpreted version.