This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author aaron_watters
Recipients aaron_watters
Date 2008-01-11.14:21:23
SpamBayes Score 0.039356437
Marked as misclassified No
Message-id <1200061286.09.0.117532205028.issue1792@psf.upfronthosting.co.za>
In-reply-to
Content
Much to my surprise I found that one of
my applications seemed to be running slow as a result
of marshal.dumps.  I think the culprit is the w_more(...)
function, which grows the marshal buffer in 1k units.
This means that a marshal of size 100k will have 100
reallocations and string copies.  Other parts of Python
(and java etc) have a proportional reallocation strategy
which reallocates a new size based on the existing size.
This mean a 100k marshal requires just 5 or so
reallocations and string copies (n log n versus n**2
asymptotic performance).

I humbly submit the following patch (based on python 2.6a0
source).  I think it is a strict improvement on the existing
code, but I've been wrong before (twice ;)).
  -- Aaron Watters
History
Date User Action Args
2008-01-11 14:21:26aaron_watterssetspambayes_score: 0.0393564 -> 0.039356437
recipients: + aaron_watters
2008-01-11 14:21:26aaron_watterssetspambayes_score: 0.0393564 -> 0.0393564
messageid: <1200061286.09.0.117532205028.issue1792@psf.upfronthosting.co.za>
2008-01-11 14:21:24aaron_watterslinkissue1792 messages
2008-01-11 14:21:24aaron_watterscreate