sage-windows icon indicating copy to clipboard operation
sage-windows copied to clipboard

Slow startup of Sage console

Open embray opened this issue 8 years ago • 6 comments

When running the main "SageMath" shortcut it takes about a second for the Sage banner to even come up (maybe it's possible to display a message very early in the startup before the Sage banner). But even after the banner comes up it can take several seconds before the sage: prompt appears, especially on the first startup.

Need to investigate areas where Sage startup time can be improved (there's an already significant improvement in https://trac.sagemath.org/ticket/23711). But might also be good to insert a message that Sage is loading--maybe even a spinner--so it doesn't just look like it's frozen.

embray avatar Aug 28 '17 11:08 embray

On the notebook, the jupyter page opens relatively well, and then you can open a notebook. But executing the first cell takes several minutes (even if it's just calculating 2+2) after that, it behaves somehow normally

profedrini avatar Nov 28 '17 13:11 profedrini

That makes sense--sage is probably not even imported before the first cell is run. It shouldn't take several minutes though. For me at worst it's a few seconds.

embray avatar Nov 28 '17 15:11 embray

Meanwhile I've seen more than a dozen of installations on various machines (Win7 and Win10) and didn't notice any unusual delay. Admittedly, it starts a bit quicker on Win7 but doesn't take more than 10 seconds on average. However, a colleague told me that he noticed very long startup times (> 5 minutes) if ConEmu is installed. It might be connected with https://conemu.github.io/en/ThirdPartyProblems.html or https://cygwin.com/faq/faq.html#faq.using.bloda. I can't say for sure if this applies here, however, I also experienced problems with cygwin64 (memory leaks) which magically disappeared after removal of AV software. BTW this Windows version of sage is a blessing and will certainly be of great help promoting sage to a wider audience. Great job, thank you Erik :)

nilqed avatar Nov 28 '17 17:11 nilqed

Yes, BLODA could have something to do with it. I use Windows Defender, but not any third party anti-virus software. Might be an interesting experiment to try (in a VM, of course--AV software can be (intentionally) harder to remove than some viruses :)

It remains a potential downside to relying on Cygwin. I still hope to work on minimizing the reliance on Cygwin for Sage's dependencies, but there are higher priorities so it's probably going to be around for some time to come.

embray avatar Nov 29 '17 17:11 embray

I recently tried the notebook myself, and it took about a minute for the first command to run in the Sage kernel. BLODA shouldn't be an issue in my case, and my machine was also under very heavy load at the time (all CPUs busy compiling).

I'll have to see if I can profile what's going on when that first command is run. The most likely culprit is that importing Sage itself takes some time, but it should be possible to speed that up a bit by pre-importing it as soon as the kernel is started, or something...

embray avatar Dec 11 '17 09:12 embray

This is still pretty painfully slow sometimes. I need to investigate what might be slowing it down so much. I suspect there might be a number of subprocesses being started just during Sage startup, which really we should try to put a stop to if at all possible.

embray avatar Nov 06 '18 09:11 embray