cgi.FieldStorage() is slow

Steve Holden steve at
Tue Nov 16 13:40:17 CET 2004

Nehal wrote:

> i wanted to created a simple CGI script for uploading files to my
> http server, and decided to use python for it. it seems to work
> fine except for one issue: there is a lot of CPU overhead.
> after profiling, it seems like:
> 	self.read_lines_to_outerboundary()
> which is called from
> 	cgi.FieldStorage()
> is the reason why it's so slow.
> when uploading small files, you won't notice a difference, but if
> you upload files larger than 2 megs, you can notice it. this
> happens on both win2k and freebsd
> is there some other way to process CGI, excluding doing it all
> manually? will this code be improved in the future?
> -- thx, Nehal

The cgi module is a confusing mess of code munged, over the years, by 
many hands. It would take a brave programmer to plunge in and do what's 

not-brave-enough-ly y'rs  - steve
Holden Web LLC +1 800 494 3119

More information about the Python-list mailing list