Hacker News new | ask | show | jobs
by gvx 1801 days ago
Very cool. One note: the browser (at least Firefox and Chrome) becomes unresponsive for a while if the code takes too long to run.

For example:

    for (i = 0; i < 1000000; i++) {
        i;
    }
1 comments

Another fun example:

    function fib(n) {
      if(n == 0 || n == 1)
        return 1;
      else
        return fib(n-1) + fib(n-2);
    }

    fib(100);
Haha, both of those cases are killing both the iframe and the UI. I have to get around to using totally different domain on the iframe to really take advantage of the Chrome process isolation. Previously I was using a really nice JS interpreter written in JS[0] before to solve that problem, but it ran 200 times slower than the browser interpreter(!)

[0] https://github.com/NeilFraser/JS-Interpreter