Forum Discussion
yozik_100692
Jan 31, 2012Nimbostratus
is pycontrol slower than the perl API?
I'm in the process of porting over some perl code to python and have noticed that getting data back is much slower with pycontrol. Has anyone else noticed this? the most basic example I have...
L4L7_53191
Jan 31, 2012Nimbostratus
Yozik, you've found the answer. That said, it's worth noting that *load* times (as opposed to call response times) will probably be faster in Perl (or Java) as well, because pyControl - really, Suds, the underlying client - parses the WSDL every time it is loaded. No, it's not ideal, but it does have its advantages...
The Perl API is very much like the old school Soapy days in Python - you construct your own XML using native structures and pass them along. This is fast, but error prone. pyControl parses the WSDL and responds with explicit type definitions that adhere to the types defined in the WSDL, which I happen to like because it's less ambiguous: you create a type using the type factory and Suds does the right thing and serializes it correctly.
Java is fast for a few reasons - primarily because it's always had killer native SOAP support, and it uses statically defined classes that gives you the advantages I mentioned above, but without the performance hit of parsing the WSDL every time you instantiate a client object. The only downside is that it's Java, so it's less script-y and user friendly, at least in my opinion.
There have been multiple requests to allow Suds to serialize out the generated classes - you could pickle them and store them for later. This would be fantastic, but it's apparently really difficult to do, and since Suds relies so heavily on weak references it's not going to happen, probably ever. Python just doesn't pickle weakrefs...
So you've landed on the right compromise, thanks to mhite. I suppose I could have just said that and left off all the commentary above :)
--Matt Cauthorn
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects