You can try with smaller number, repeat it a few times. I try with 100000 and it works.
Electrum wallet is not designed to handle large number of keys/transactions so I seriously doubt it can perform well for anything beyond a couple of hundred keys.
I did not know about that and tried it yesterday.
Creating 100,000 addresses take a few minutes.
Exporting 100,000 private keys for those addresses takes me about 4 hours. That is a painful experience. I can stop it anytime but I want to see how it works and 4 hours is my waiting time for this practice.
So with Electrum, if you do it a few times, you can create 10M addresses and private keys but a lot of time will be needed.