Improve import time #158
Replies: 3 comments 5 replies
-
Hello, I have made some experiments before in the old version, hope the conclusions help :) Then, I test a sample: def test():
import dis
del sys.modules['dis']
del sys.modules['opcode'] Call this function 10, 000 times
After optimization, ~1% speedup.
Most of the time in this process is spent on
Since the use case was removed more details are missing, only some simple conclusions :(
|
Beta Was this translation helpful? Give feedback.
-
I think that knowing the hardness of the typical atomic tasks listed in the initial post of that discussion is important and helpful. Disclosure:
I expect that during import the variable number of file system trees the system calls are issued across are the cause of slow start at least for use cases with deep and wide dependency trees. Any measurement of these actions should in my experience document (and consider)
Does the reference implementation team have access to specific reference environments (hardware included) to conduct such trial and ideally operate benchmarks to guide and rate implementation alternatives? In the absence of such reference environments, I fear that the data may not provide actionable metrics for guiding implementations of the import task (as a whole, not the steps in isolation).
|
Beta Was this translation helpful? Give feedback.
-
I doubt that the I/O proper is the main cost. On my Mac (no Windows Defender running :-) the open+read take only 28 usec, compared to 255 usec for marshal.loads. (And the whole import is 1.6 msec.) The best way to speed up I/O when Windows defender is running is probably turning it off. (Steve Dower would tell me that we should complain to the Windows Defender team though. :-) If you write a little snippet of code that creates a much larger file and then tests how fast it is to read part of it I can see what the timings are on my Windows box though. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We've been thinking a lot about startup time, and we've done some good work (freeze and deep-freeze).
As that work is winding down, let's take some time to recognize that when most users talk about slow startup time, they include the time to start their application in that. And the fraction that they have the least control over is the cost of import itself.
There are a couple of parts to this:
Let's measure the times each of these takes and see how we can improve that time.
Beta Was this translation helpful? Give feedback.
All reactions