2 years ago
#64617

jon_two
Why are Python imports sometimes slow when using Hyper-V?
I'm a Python developer and usually work on a Linux VM, running on a Windows 10 laptop. Previously I used Oracle Virtualbox, but since I've switched to Hyper-V, I've noticed that the Python application I'm working on is sometimes slow to start. It only happens for the first run of the day, then occasionally later on, after I haven't run it for an hour or two, so I'm wondering if perhaps something is being cached in between to prevent the slow startup.
The Python application I work on already has a fairly slow startup (for example, a -h
call typically takes 5-10s). I've profiled this and it's due to importing dependencies, pandas
being the main culprit. As I mentioned above though, two or three times a day, it takes more like 40s. If I repeat the same command straight away, it's back to 5s.
My question is - has anyone else seen similar behaviour? I've seen it on both CentOS 8 and Rocky 8.5 guests, but only on Hyper-V. It doesn't happen on Oracle Virtualbox, or on standalone CentOS/Rocky machines. I'm using Hyper-V 10.0.19041.1 on Windows 10 Pro, build 19044.1466.
python
linux
hyper-v
0 Answers
Your Answer