ntpviz - Don't plot a line during data absence

Gary E. Miller gem at rellim.com
Sun Oct 23 18:46:42 UTC 2016


Yo Jason!

On Sun, 23 Oct 2016 12:39:42 -0400
Jason Azze <jason at azze.org> wrote:

> I like the change.

Good.  Not heard any complaints.

> I've attached a sample image (I hope that's kosher
> on the list), where you see peer "chilipepper" appear and disappear.

I find it harder to find the fragments without the 'extra' lines, but I
see it is more important to not confuse people that do not start at it
all day.  So I'll keep it as a fixed feature for now.

> Whether or not it is worth a 10% slowdown is certainly debatable.

I have some ideas to improve it.  I have been thinking of re-arranging
the data schema for other reasons.

Most can stop reading here, only those that care about optimization and
speed should continue.

The big problem here is that it adds 4 more float() conversions per
data point.  That is a large overhead when plotting millions of points.

I am also learning more about Python.  Here is the hot code, executed
millions of times:

        # a is a string of the current time, b is a float of the last time
	if 1024 < ( float( a ) - b):
		# do something
        b = float(a)

So, two float conversions per cycle.  If C you would do this to
change a float to a store to make it much faster:

        # a is a string of the current time, b is a float of the last time
        # c is a float of the current time
        c = float (a )
	if 1024 < ( c - b):
		# do something
        b = c

In C that would be much faster, but in Python it is slower!  In Python
it seems to be slower to create a new variable than to convert a string
to a float.

Proving once, if you are looking for speed you need to profile, and
expect to be surprised often.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	gem at rellim.com  Tel:+1 541 382 8588
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ntpsec.org/pipermail/devel/attachments/20161023/f5994ac4/attachment.bin>


More information about the devel mailing list