John Nagle nagle at animats.com
Sat Oct 11 17:54:49 CEST 2008

James Mills wrote:
> $ ./bench.py -m latency -t 10 -f 100
> Setting up latency Test...
> Latency: 1.52 ms
> Latency: 0.78 ms
> Latency: 0.76 ms
> Latency: 0.76 ms
> Latency: 0.77 ms
> Latency: 0.77 ms
> Latency: 0.76 ms
> Latency: 0.76 ms
> Latency: 0.76 ms
> Latency: 0.77 ms

     Interesting.  Can you do something to get rid of that
transient on the first try?  What matters for hard real time
is the WORST value, not the average value.

     Since Python is reference-counted, there's hope of using it
for hard real time.  If you use weak pointers for all back
pointers, and avoid pointer loops, you don't need garbage
collection.  Put the garbage collector into debug mode and
dump the garbage list after testing for a while to see if you
have any leaks.

     CPython is slow, but can be made repeatable.

     It helps if you run on a machine configured with no swap file,
(or an OS with no paging, like QNX) so you can be sure
there won't be any paging.  Then make sure you've gotten rid of
anything unwanted running in the background (always a headache
on Windows), and crank up the priority of your real-time task.

     And put in a hardware stall timer.

			John Nagle

More information about the Python-list mailing list