What do you mean by saying bottlenecks? I don't get it? I can't think of a more productive way to do it. First take all the possible combinations, and then run a program that checks every line.
1. you are working with strings, they are inherently slower than integers (or bits to be more exact).
2. that also means you have to keep converting back and forth between strings and bytes when creating checksum while also having to normalize the text with Electrum defined algorithm
3. printing the result whether to UI or to file is also an extremely slow process (that is why your UI hangs when the number of words is higher than 4-5).
4. you don't have to produce ALL possible combinations, it can be reduced by 94% if you validate checksum! (about 6% are correct in BIP39 and i believe it is the close to same value for Electrum).
About that, on BIP39 I've noticed that it doesn't matter the checksum. Whatever seed you'll submit on electrum it will take it.
it should matter, if your checksum is invalid then
this line will return false (an invalid seed phrase).
same with BIP39, if your SHA256 checksum is invalid it will be rejected (
reference implementation).