[portland] Portland Digest, Vol 55, Issue 1
Benjamin van der Veen
b at bvanderveen.com
Tue Nov 1 17:41:46 CET 2011
> If I remember correctly, instances of all single byte ints (0 <= x <
> 256) are created automatically, so iterating over a bytearray may
> avoid new object creation.
That would certainly make sense. I wouldn't be too surprised if it
pre-allocated/interned single-byte chars as well.
> Yeah, everything is a heap allocated PyObject in CPython. Check out
> Cython for writing Python that compiles to C and can use raw C types
> (bytes & chars) without much effort. Depending on your use case and
> dependencies, PyPy might be worth checking out. Doing lots of
> iterations over homogeneous data types is where JITs shine.
Thanks for the pointers, Michael!
More information about the Portland