Jeff Epler 568636d562 run_background_tasks: Do nothing unless there has been a tick
This improves performance of running python code by 34%, based
on the "pystone" benchmark on metro m4 express at 5000 passes
(1127.65 -> 1521.6 passes/second).

In addition, by instrumenting the tick function and monitoring on an
oscilloscope, the time actually spent in run_background_tasks() on
the metro m4 decreases from average 43% to 0.5%. (however, there's
some additional overhead that is moved around and not accounted for
in that "0.5%" figure, each time supervisor_run_background_tasks_if_tick
is called but no tick has occurred)

On the CPB, it increases pystone from 633 to 769, a smaller percentage
increase of 21%.  I did not measure the time actually spent in
run_background_tasks() on CPB.

Testing performed: on metro m4 and cpb, run pystone adapted from python3.4
(change time.time to time.monotonic for sub-second resolution)

Besides running a 5000 pass test, I also ran a 50-pass test while
scoping how long an output pin was set.  Average: 34.59ms or 1445/s on m4,
67.61ms or 739/s on cbp, both matching the other pystone result reasonably
well.

import pystone
import board
import digitalio
import time

d = digitalio.DigitalInOut(board.D13)
d.direction = digitalio.Direction.OUTPUT

while True:
    d.value = 0
    time.sleep(.01)
    d.value = 1
    pystone.main(50)
2019-11-18 11:26:48 -06:00
..
2018-07-12 14:13:51 -04:00
2018-07-12 14:13:51 -04:00
2018-07-12 14:13:51 -04:00
2018-07-12 14:13:51 -04:00
2018-08-09 13:29:30 -07:00
2019-10-21 18:57:03 -07:00
2018-08-16 17:41:35 -07:00
2018-07-28 13:29:47 -04:00
2019-06-06 17:49:32 -04:00
2018-08-09 13:29:30 -07:00
2019-04-05 21:38:32 +02:00
2018-07-11 16:45:30 -04:00
2018-07-11 16:45:30 -04:00
2018-10-18 10:37:42 -07:00
2019-04-05 21:41:40 +02:00
2019-01-18 17:09:56 -08:00
2018-10-07 19:37:49 +02:00
2018-11-13 22:04:44 +01:00
2017-07-18 11:57:39 +10:00
2018-07-12 14:13:51 -04:00
2018-07-11 16:45:30 -04:00
2018-07-12 14:13:51 -04:00
2018-07-12 14:13:51 -04:00
2018-07-12 14:13:51 -04:00
2019-01-18 11:53:09 -08:00
2019-01-20 17:32:43 -08:00
2019-01-14 18:09:02 -08:00
2019-11-05 17:49:47 -08:00
2019-04-05 21:40:28 +02:00
2019-01-20 16:18:34 -08:00
2018-08-09 13:29:30 -07:00
2018-08-07 14:58:57 -07:00
2018-05-14 17:41:17 -04:00
2018-05-14 17:41:17 -04:00
2019-10-21 18:57:03 -07:00
2018-07-11 16:45:30 -04:00
2018-07-11 16:45:30 -04:00
2019-02-15 16:53:19 -08:00
2019-10-21 18:57:03 -07:00