Skip to content
Advertisement

Tag: boxing

Why are Python’s arrays slow?

I expected array.array to be faster than lists, as arrays seem to be unboxed. However, I get the following result: What could be the cause of such a difference? Answer The storage is “unboxed”, but every time you access an element Python has to “box” it (embed it in a regular Python object) in order to do anything with it.

Advertisement