top | item 45532283

(no title)

repsilat | 4 months ago

This might have been your experience, but mine has been very different. In my experience a typical python workload is 50% importing python libraries, 45% slow python wrapper logic and 5% fast native code. I spend a lot of time rewriting the python logic in C++, which makes it 100x faster, so the resulting performance approaches "10% fast native logic, 90% useless python imports".

discuss

order

kccqzy|4 months ago

There is more than one PEP related to making imports faster such as PEP 690 or PEP 810. It's definitely a well-known problem. The solution is probably right around the corner.

b3orn|4 months ago

Imports being slow is annoying, but only matters to short running code.

repsilat|4 months ago

Many simple scripts at my work that more or less just argparse and fire off an HTTP request spend half a minute importing random stuff because of false deps and uncommon codepaths. For some unit tests it's 45 seconds, substantially longer than the time taken to run the test logic.

In dev cycles most code is short-running.

ActorNightly|4 months ago

If imports are slow, you need to not be writing python in the first place, because you are either on limited hardware or you are writing a very performant app.