You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • It won't be anywhere near as good, as Micro Python does a certain amount of JIT compilation, and I believe also runs at twice the clock speed. There's some info on performance here: http://www.espruino.com/Performance

    function performanceTest() {
        var secs = getTime;
        var endTime = secs() + 10;
        var count = 0;
        while (secs() < endTime)
            count++;
        print("Count: "+ count);
    }
    performanceTest();
    // Count: 92990
    

    However if you use the Web IDE to pre-compile the function (which only works in some limited cases, but this is one of them):

    function performanceTest() {
        "compiled";
        var secs = getTime;
        var endTime = secs() + 10;
        var count = 0;
        while (secs() < endTime)
            count++;
        print("Count: "+ count);
    }
    performanceTest();
    // Count: 590702
    

    It's also a little unfair, because getTime in Espruino is accurate to the nearest microsecond and also uses floating point. Doing that requires a certain amount of calculation, which will be slowing Espruino down compared to Micro Python.

    But honestly, it's not what Espruino is about. It's about speed of development vs speed of execution, while still being able to run on relatively low-end hardware.

About

Avatar for Gordon @Gordon started