|
|
|
|
|
by s-macke
3933 days ago
|
|
Well, just look at these lines of code: https://github.com/s-macke/jor1k/tree/master/js/worker/or1k/... I tried something like this already. I mean to recompile parts of the code into Javascript. In my test cases the speed benefit was a factor of two or three. However in the real world, it was around a factor of two slower for different reasons. 1. The heuristic to find code chunks, which are good to recompile takes a lot of time and memory. 2. To stay on the safe side I can only recompile from jump to jump like QEMU does. Anything else would mean a much more complicated heuristic and recompilation which would beat the complexity of QEMU. 3. asm.js code runs through an foreign function interface. That means, you have to stay very long in the asm.js styled code that it is worthwhile. I got a drop of a factor of 10 in speed when I try to compile ~20 lines of code into asm.js code instead of normal Javascript code. |
|
I am currently designing a software-only CPU with sliding register window (128 entries) and dirt simple instruction set. The for/switch/loop emulator for it should be quite a bit faster than any emulated silicon CPU.