[Python-bugs-list] performance-problem decoding quoted-printable (PR#340)

ragnark@vestdata.no ragnark@vestdata.no
Fri, 26 May 2000 10:52:00 -0400 (EDT)


--7JfCtLOvnd9MIVvH
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hi

Problem on python 1.5.1 on linux 2.2.14aa6.

Decoding quoted-printable files using mimetools.decode is really slow.
The really strange thing is, that it appers to work a lot faster on
smaller files!

I put together a little test-program that reads blocks from a file, and
decodes them individually. (The output will not be 100% correct. The
point was just to test the performance). 

Results show the time it took to decode a 300k file with the diferent
block-sizes:
1k:	6.28 s
3k:	6.59 s
10k:	8.57 s
30k:	30.45 s
100k:	127.82 s
300k:	221.67 s

I looked in quopri.decode for clues about the problem, but could not
find any. Is there something _very_ wrong with my reasoning, or is
something wrong here?



-- 
Ragnar Kj°rstad

--7JfCtLOvnd9MIVvH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="test.py"

#!/usr/bin/python
from mimetools import decode
from StringIO import StringIO
from sys import stdout, argv
from string import atoi
bsize=atoi(argv[1])
output=StringIO()
f=open("mail-test")
s=f.read(bsize)
while s:
	input=StringIO(s)
	decode(input, output, 'quoted-printable')
	s=f.read(bsize)
	stdout.write('.')
	stdout.flush()
stdout.write('done\n')

--7JfCtLOvnd9MIVvH--