• Sun 2018.08.26

    I have a need for extremely accurate function call timing.

    It would be nice to have a range of argument values at:

    http://www.espruino.com/Reference#l__glo­bal_setInterval

    I'm seeing limitations of the IDE keeping up around 80-100ms

    But, as in browsers, faster times might be possible?

    http://www.adequatelygood.com/Minimum-Ti­mer-Intervals-in-JavaScript.html

    What is the shortest reliable duration?



    The above pre-supposes all called code would execute before the next call.

    Also, need to apply a delay using setTimeout() under the same reliable constraint.

  • What is the shortest reliable duration?

    A millisecond should be safe, but you should be able to get a bit less than that. Obviously if other code is executing that can delay execution, but if as you say your code has finished executing then you'll be fine.

    If you need to get very fast, you might be able to use digitalPulse,etc. Another option is to set up a PWM output, connect it to an input, and then watch that input with setWatch(...., {irq:true}) and use compiled code.

    I'm seeing limitations of the IDE keeping up around 80-100ms

    Do you have an example of code that does this?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

What is the fastest time or shortest duration for reliable setInterval()

Posted by Avatar for Robin @Robin

Actions