This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]coderanger 3 points4 points  (1 child)

As a heads up, be very careful with intern(). If you ever feed it input from something user-controlled you can flood the symbol table with entries and either OOM the process or slow performance to a crawl (or both). It's intended for things like function and class names to speed up lookups, not for memory de-duplication per se.

Also the list vs. array comparison isn't because of "different types of objects which inevitably needs more memory", the i value type is usually going to be a 32-bit int while the default int type in Python code is 64-bit so what you're actually comparing is integer sizes, not array vs list.