Python makes it hard to get this right. Simple idioms result in copies of large collections or other work shifting from C to Python. The state-of-the-art of Python profiling [1] has to target this problem to the exclusion of other concerns.
[1]: https://www.thestrangeloop.com/2022/python-performance-matte...