atom-language-idris icon indicating copy to clipboard operation
atom-language-idris copied to clipboard

Abominably slow startup time.

Open alexchandel opened this issue 10 years ago • 16 comments

This package adds 143ms to my startup time, compared to a typical 2ms-3ms for languages and 10ms for linters. Not cool.

alexchandel avatar Jun 12 '15 08:06 alexchandel

thank you. And I agree

archaeron avatar Jun 12 '15 10:06 archaeron

Is it just the failure to find the compiler, and/or the failure to load it (#23)?

alexchandel avatar Jun 13 '15 06:06 alexchandel

No, mine is slow too and it doesn't have those errors. The problem is probably that the package asks the idris compiler what version it is and then uses a different flag to start the ide-mode. So it needs to start a process every time atom starts. At least that's probably the main reason.

@david-christiansen how do you handle this? Do you still have support for the old version of idris?

archaeron avatar Jun 13 '15 13:06 archaeron

Both flags work in Idris and will for a few releases. But each release of idris-mode is designed to work with the corresponding version of Idris and we don't make any guarantees beyond that. In practice, compatibility is good, but this policy keeps my testing labor reasonable.

That said, why not wait to load Idris until the first time you typecheck a file? That way, the slowness doesn't get in the way of other uses of Atom. This is how it works in Emacs.

david-christiansen avatar Jun 13 '15 13:06 david-christiansen

so could I always use --ide-mode instead of --ideslave?

When I make the change that you manually invoke the typecheck like wished in this ticket: https://github.com/idris-hackers/atom-language-idris/issues/27 it makes sense to start the compiler on first use, so I'll keep this in mind.

archaeron avatar Jun 13 '15 14:06 archaeron

Yeah, I think it's safe to switch it to --ide-mode. Older Idrises will just have to be updated to use the new editor plugins. We shouldn't break compatibility for no reason, but Idris is still early enough that we also shouldn't, in my opinion, put HUGE effort into it. At least not yet... As long as people can stick with an older editor plugin for an older compiler.

david-christiansen avatar Jun 13 '15 18:06 david-christiansen

Nice, this simplifies the code a lot. As long as both Idris and atom-language-idris are not yet on version 1 maybe it's okay.

Oh and this pull request will be large.

archaeron avatar Jun 13 '15 21:06 archaeron

commenting these two lines https://github.com/idris-hackers/atom-language-idris/blob/optional-typecheck/lib/idris-controller.coffee#L1-L2 (requireing atom-message-panel) makes the package load about 50ms faster. Maybe we should use another way of displaying errors.

archaeron avatar Jun 30 '15 20:06 archaeron

I found out what made the startup of this package so slow. When I remove the atom-space-pen-views the startup time drops from about 140ms to about 20ms. Now I only need to convert the views.

archaeron avatar Jun 30 '15 22:06 archaeron

Rewrote the holes view. not my best code and I'll need to cean it up, but it looks the same now, but the package loads a lot faster now.

https://github.com/idris-hackers/atom-language-idris/commit/77aa8897f61edbcae4bd2ec0106f47dc09ba08d5

archaeron avatar Jul 02 '15 17:07 archaeron

time is now down to ca. 80ms from ca. 140ms before.

archaeron avatar Jul 04 '15 18:07 archaeron

the only way to make a significant impact on the loading time now would be to totally rip out atom-message-panel. I might do that someday, but the starting time is now already down to bit more than half of what it was before.

archaeron avatar Jul 16 '15 23:07 archaeron

Much better, thanks! This is still my slowest package, but not by as much now.

alexchandel avatar Aug 03 '15 09:08 alexchandel

glad it helped :) maybe an atom-message-panel will solve the problem in the future. It doesn't look mantained though. I might have to change.

archaeron avatar Aug 03 '15 21:08 archaeron

@archaeron Please reopen. This is an issue again, and it's up to 200-240ms on average now.

I have no Idris files open, and even if I did, I haven't used the typecheck command yet.

alexchandel avatar Feb 17 '16 21:02 alexchandel

One way to handle this is to split the package into a pure grammar package and an "ide" package that depends on the grammar package, and put an activationHook so that the ide package isn't activated until an idris file is loaded. Then the loading time will only be paid when doing idris stuff.

melted avatar Jul 16 '16 12:07 melted