Avatar for ThomasChr


Member since Sep 2017 • Last active Jan 2019
  • 3 conversations

Most recent activity

  • in General
    Avatar for ThomasChr

    Hello Forum,

    this little test may neither be fair nor exact but i still wonder about the outcome...

    The Leibniz Formula is a little float Problem for calculating Pi.

    I wrote the code in Python and Javascript and let it run on the PyBoard and the Espruino Pico.

    Here‘s the Python-Code:

    import time
    iterations = 1000000
    x = 1
    pi = 1
    start = time.time()
    for i in range(2, iterations + 2):
       x = x * -1
       pi = pi + (x / (2*i-1))
    pi = pi * 4
    print('Pi: ' + str(pi))
    end = time.time()
    print('Time taken for ' + str(iterations) + ' Iterations: ' + str((end - start)*1000000) + ' Mikroseconds')

    And here‘s the „same“ in Javascript:

    var iterations = 1000000;
    var x = 1;
    var pi = 1;
    var begin=Date.now();
    for (i = 2; i < iterations + 2; i++) {
      x = x * -1;
      pi = pi + (x / (2*i-1));    
    pi = pi * 4;
    console.log('Pi: ' + pi);
    var end= Date.now();
    console.log('Took ' + ((end-begin)*1000) + ' Microseconds');

    On the PyBoard the code took 26 seconds to execute, the Pico took 458 seconds.

    I‘m a little puzzled of the outcome because I though both boards have floating point hardware, or am I wrong?

    Can anyone explain the massive speed difference to me?


    PS: I know that this synthetic benchmark has nothing to do with overall speed, I just want to understand why these numbers are what they are in this particular case.

  • in Porting to new Devices
    Avatar for ThomasChr

    Hey Gordon, thats great news!

    I'm not that into Social Media, but @DieSchatzjger is my not so often used Twitter Account :-)


  • in News
    Avatar for ThomasChr

    @Gordon: Take your time. Espruino is great, but having a son is so much more :-)

  • in Porting to new Devices
    Avatar for ThomasChr

    I've made a PR to discuss my code: https://github.com/espruino/Espruino/pul­l/1255

    The large lib is not a problem of code size on the due. It's ~250 MBs of Code in the Espruino Repo.

  • in Porting to new Devices
    Avatar for ThomasChr

    Hi Gordon!

    I think the code is kind of ready - setWatch is missing, also PWM, ADC and more UARTs - so a few things are left to do.

    But the included library is large (and also does include some manuals), so I think first I need to tidy up a little bit.


  • in Porting to new Devices
    Avatar for ThomasChr

    So... 'save()' is working now. It's not super reliable though. I think I need to make some debugging.
    Systemtime does now work down to the millisecond and has no overflow after 40 days any more...

  • in Porting to new Devices
    Avatar for ThomasChr

    We now have access to all pins (I counted 63 Pins - impressive) and the SystemTimer for setInterval() and setTimeout() is working - kind of. Not very accuracte. I'm on it.

    If someone wants to have a go, here are the Bin-Files: https://www.thomaschristlieb.de/wp-conte­nt/uploads/2017/09/espruinoduebin.tar.gz­

    I think after getting a real accurate Time (better than one Second!) I'm trying to get save() to Work...

  • in Porting to new Devices
    Avatar for ThomasChr

    I've got a REPL, I've got Pin Functions (Config, Get, Set) for the first Pin (the onboard LED). I think we can call it Alpha Status :-)

    Next would be to get the setTimeout running by implementing jshGetSystemTime with the build-in RTC. Then I need to enter all possible pins (all 54!) and make the Pin Functions for them.

    Thats a lot of work, but not very complicated anymore.