Python numbers every programmer should know
mkennedy.codes
Python numbers every programmer should know
1–10 of 191 posts
Re: Python numbers every programmer should know
#2Re: Python numbers every programmer should know
#3Re: Python numbers every programmer should know
#4More contentiously: don't fret too much over performance in Python. It's a slow language (except for some external libraries, but that's not the point of the OP).
Re: Python numbers every programmer should know
#5When this starts to matter, python stops being the right tool for the job.
Re: Python numbers every programmer should know
#6Re: Python numbers every programmer should know
#7Re: Python numbers every programmer should know
#8I doubt list and string concatenation operate in constant time, or else they affect another benchmark. E.g., you can concatenate two lists in the same time, regardless of their size, but at the cost of slower access to the second one (or both). More contentiously: don't fret too much over performance in Python. It's a slow language (except for some external libraries, but that's not the point of the OP).
Re: Python numbers every programmer should know
#9Counterintuitively: program in python only if you can get away without knowing these numbers. When this starts to matter, python stops being the right tool for the job.
Re: Python numbers every programmer should know
#10For example, my M4 Max running Python 3.14.2 from Homebrew (built, not poured) takes 19.73MB of RAM to launch the REPL (running `python3` at a prompt).
The same Python version launched on the same system with a single invocation for `time.sleep()`[1] takes 11.70MB.
My Intel Mac running Python 3.14.2 from Homebrew (poured) takes 37.22MB of RAM to launch the REPL and 9.48MB for `time.sleep`.
My number for "how much memory it's using" comes from running `ps auxw | grep python`, taking the value of the resident set size (RSS column), and dividing by 1,024.
1: python3 -c 'from time import sleep; sleep(100)'