
April 2, 2018
6:34 a.m.
Of course, the question is whether all this matters. Is it important to save 8 bytes on each unicode object? Only testing would tell.
Last year, I tried to profile memory usage of web application in my company. https://gist.github.com/methane/ce723adb9a4d32d32dc7525b738d3c31#investigati... Without -OO option, str is the most memory eater and average size is about 109bytes. (Note: SQLAlchemy uses docstring very heavily). With -OO option, str is the third memory eater, and average size was about 73bytes. So I think 8bytes for each string object is not negligible. But, of course, it's vary according to applications and libraries. -- INADA Naoki <songofacandy@gmail.com>