cgi.FieldStorage() is slow

Andrew Clover and-google at doxdesk.com
Wed Nov 17 08:47:05 EST 2004


Nehal <nehalmistry at gmx.net> wrote:

> when uploading small files, you won't notice a difference, but if
> you upload files larger than 2 megs, you can notice it.

Yep. Large file upload in cgi.py is slow. I don't immediately see a
way to speed it up without re-architecting some of its internals.

In any case I dislike(*) the cgi module's interface too, so I rewrote
the lot:

  http://www.doxdesk.com/software/py/form.html

This isn't drop-in compatible, and is getting a bit crusty (I'm
expecting to rewrite most of it soon to be more objecty/threadable,
and support WSGI), but in my experience it's considerably faster than
cgi for very large files. (We were commonly using files in the 10-50MB
range.)

(* - more then than now; cgi's interface has got slightly better since
Python 1.5.2's time.)

-- 
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/



More information about the Python-list mailing list