There are numbers every Python programmer should know. For example, how fast or slow is it to add an item to a list in Python? What about opening a file? Is that less than a millisecond? Is there something that makes that slower than you might have guessed? If you have a performance sensitive algorithm, which data structure should you use? How much memory does a floating point number use? What about a single character or the empty string? How fast is FastAPI compared to Django? I wanted to take a moment and write down performance numbers specifically focused on Python developers. Below you will find an extensive table of such values. They are grouped by category. And I provided a couple of graphs for the more significant analysis below the table. Source code for the benchmarks This article is posted without any code. I encourage you to dig into the benchmarks. The code is available on GitHub at: https://github.com/mikeckennedy/python-numbers-everyone-should-know ๐ System Information The benchmarks were run on the sytem described in this table. While yours may be faster or slower, the most important thing to consider is relative comparisons. Property Value Python Version CPython 3.14.2 Hardware Mac Mini M4 Pro Platform macOS Tahoe (26.2) Processor ARM CPU Cores 14 physical / 14 logical RAM 24 GB Timestamp 2025-12-30 Python numbers you should know More analysis and graphs by category below the table. Category Operation Time Memory ๐พ Memory Empty Python process โ 15.73 MB Empty string โ 41 bytes 100-char string โ 141 bytes Small int (0-256) โ 28 bytes Large int โ 28 bytes Float โ 24 bytes Empty list โ 56 bytes List with 1,000 ints โ 7.87 KB List with 1,000 floats โ 8.65 KB Empty dict โ 64 bytes Dict with 1,000 items โ 36.1 KB Empty set โ 216 bytes Set with 1,000 items โ 32.2 KB Regular class instance (5 attrs) โ 48 bytes __slots__ class instance (5 attrs) โ 72 bytes List of 1,000 regular class instances โ 165.2 KB List of 1,000 __slots__ class instances โ 79.1 KB datac...
First seen: 2026-01-01 17:11
Last seen: 2026-01-02 13:14