Commented: (MODPYTHON-93) Improve util.FieldStorage
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > Commented: (MODPYTHON-93) Improve util.FieldStorage




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Commented: (MODPYTHON-93) Improve util.FieldStorage  
Mike Looijmans (JIRA)


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-26-06 12:12 PM

[ http://issues.apache.org/jira/brows...2444
850 ]

Mike Looijmans commented on MODPYTHON-93:
-----------------------------------------

A very simple approach would be to delete the dictionary attribute when
any change is made.

The add_field method should be made private, and one could add a
__setitem__ method like this:

def __setitem__(self, key, value):
if self.__dict__.has_key('dictionary'):
del self.dictionary
self._add_field(key, value)

A similar approach can be taken to add the __delitem__ functionality.


Mike Looijmans
Philips Natlab / Topic Automation




> 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 implem
ents 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 a
ll
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 Fie
ldStorage instance is created.
> Mike Looijmans has been investigating StringField and Field as well. It is probabl
y reasonable to include information on his work in this issue as well, so that we ca
n consider all of these efficiency issues in toto.






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:13 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register