SNMP Toolkit

Ilya Etingof ilya at cray.glas.net
Mon Jun 28 08:01:12 CEST 2004


Les Smithson <lsmithso at nohare.spam.demon.co.uk> wrote:

[ skipped ]

> Out of interest, I ran a simple pysnmp test using the Python
> profiler. The test case was a 1000 loops of a GETREQUEST/GETRESPONSE
> of sysDescr, using pysnmp 2.0.8 on a Linux box. The top 10, sorted by
> time, were:

In fact, I was talking of pysnmp-3.4.x code. Although it's still experimental,
it is better supported and developed. I'm not sure I've done significant optimisation
to 2.x.x code...

[ skipped ]

> By fiddling with the args/ARGS dictionary merging code in
> v1.py:240(update), I cut its internal time by around 50%. I haven't
> found any significant optimisations elsewhere. I can't figure out
> where the time goes in the asn1.py decode/encode/update functions -
> they don't have any loops and there's not much to them.

Right. In addition to function call and instantiation penalites, I'd
suggest attribute reference as another possible CPU eater. ;-/

> Would using the array module for holding the PDU make a difference?

I do not think it would be of much help with pysnmp 2.x.x, but it might
boost overall performance with 3.x.x. In fact, the easiest way would be
to cache just a pair of Message objects -- one for request message and 
another for response.

-ilya



More information about the Python-list mailing list