[issue6688] Optimize PyBytes_FromObject.

2010-01-09 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: Committed in r77398. -- resolution: -> accepted stage: patch review -> committed/rejected status: open -> closed ___ Python tracker ___ _

[issue6688] Optimize PyBytes_FromObject.

2009-08-22 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Nice improvement! Beware that _PyObject_LengthHint may set an exception, though. -- nosy: +amaury.forgeotdarc ___ Python tracker ___ _

[issue6688] Optimize PyBytes_FromObject.

2009-08-11 Thread Alexandre Vassalotti
New submission from Alexandre Vassalotti : Optimize PyBytes_FromObject by adding special-cases for list and tuple objects and by using _PyObject_LengthHint() instead of an arbitrary value for the size of the initial buffer. [Without the patch] ./python -m timeit -s "x = list(range(256))" "bytes(