I have a suggestion for speeding up the performance of code like this:
fields = cgi.FieldStorage()
if fields: ...
which, as it turns out, invokes FieldStorage.__len__(), which in turn
calls FieldStorage.keys(), which builds a list of keys by hand, taking
several minutes for large forms. This
In [EMAIL PROTECTED], Bob Kline wrote:
I have a suggestion for speeding up the performance of code like this:
fields = cgi.FieldStorage()
if fields: ...
which, as it turns out, invokes FieldStorage.__len__(), which in turn
calls FieldStorage.keys(), which builds a list of keys by hand,
Bob Kline wrote:
I have a suggestion for speeding up the performance of code like this:
fields = cgi.FieldStorage()
if fields: ...
which, as it turns out, invokes FieldStorage.__len__(), which in turn
calls FieldStorage.keys(), which builds a list of keys by hand, taking
several minutes
Marc 'BlackJack' Rintsch wrote:
def keys(self):
return {}.fromkeys([i.name for i in self.list]).keys()
This does not maintain the order of `self.list`. Don't know if there's
code relying on this.
Such code would be flying in the face of an implication that the order
of the keys
Sybren Stuvel wrote:
FieldStorage.__nonzero__ tried first if it exists. You might want to
use that for more optimization.
Excellent suggestion! It would be nice if this were adopted to
supplement the original optimization, rather than replace it.
Bob
--
Georg Brandl wrote:
Post a RFE to the Python Tracker at
http://sourceforge.net/tracker/?group_id=5470atid=355470
If you want, assign it to me (gbrandl).
Done, thanks.
Bob
--
http://mail.python.org/mailman/listinfo/python-list