quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Graham Dumpleton (JIRA)" <j...@apache.org>
Subject [jira] Reopened: (MODPYTHON-93) Improve util.FieldStorage efficiency
Date Tue, 21 Nov 2006 22:51:02 GMT
     [ http://issues.apache.org/jira/browse/MODPYTHON-93?page=all ]

Graham Dumpleton reopened MODPYTHON-93:
---------------------------------------

             
After further experimentation, following the Trac model of having __setitem__() be an alias
for add_field() is a pain in the neck. As reminder, the Trac way of doing things mean't that
assigning using subscript operator resulted in additional field values being added rather
than existing ones being replaced as the subscript operator works in every other dictionary
like data structure.

Having it work this way, it is too easy to forget it is different and your code doesn't work
as expected. For newbies this could cause a lot of grief. Thus, how Trac did things should
be ignored and need to make __setitem__() replace all existing values for field like a normal
dictionary. If someone wants to add additional values, they should use add_field() instead.

Doing this will not cause any problems for Trac compatibility as Trac overrides __setitem__()
in a derived class anyway.

> Improve util.FieldStorage efficiency
> ------------------------------------
>
>                 Key: MODPYTHON-93
>                 URL: http://issues.apache.org/jira/browse/MODPYTHON-93
>             Project: mod_python
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.2.7
>            Reporter: Jim Gallacher
>         Assigned To: Graham Dumpleton
>            Priority: Minor
>             Fix For: 3.3
>
>         Attachments: modpython325_util_py_dict.patch
>
>
> Form fields are saved as a list in a FieldStorage class instance. The class implements
a __getitem__ method to provide dict-like behaviour.  This method iterates over the complete
list for every call to __getitem__. Applications that need to access all the fields when processing
the form will show O(n^2) behaviour where n == the number of form fields. This overhead could
be avoided by creating a dict (to use as an index) when the FieldStorage instance is created.
> Mike Looijmans has been investigating StringField and Field as well. It is probably reasonable
to include information on his work in this issue as well, so that we can consider all of these
efficiency issues in toto.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message