-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow activation time #565
Comments
Glad you asked. Merge these already:
This isn't just hacky, it's also bloated. The amount of code I've written to patch loaded packages is one thing; but you have any idea what that does to V8? It forces recompilation of already compiled JavaScript, so yeah, of course it's going to slow everything down. |
FYI, the more packages that're active and cross-referencing loaded code, the bigger the hit to loading time. Just saying. This isn't hyperbole, this is a pretty realistic concern. |
They're prioritized (though we do have ~30 items on the Priority list). |
Relief to exhausted ears. Seriously. Thank you. |
For me, loading is taking 291 ms and activation is taking 3415ms. I would be really great if this could be improved. |
@50Wliu Uh, if my pull-requests could be merged sooner rather than later, that'd be great... |
I do not merge PRs unless I am confident I understand the change, the relevant codebase, and am willing to deal with regressions/followups. Otherwise, the extent of my participation is making sure the relevant team members are aware of the PR (they are) and sometimes giving a basic review. |
I'm an Atom recent convert. file-icons is my slowest at start-up; 1551ms. Followed by Spell-check and then Project-Viewer (1395 and 1152 ms respectively). It would be good to speed this up but I like the icons so will suffer if it is necessary. |
Shouldn't be necessary forever, but that's up to the Atom team. :p |
PRs merged! Gonna enjoy fixing this... @50Wliu, you mightn't see that much of a speed improvement if you're running a recent build of Atom. But the plan is to make package activation asynchronous (and therefore, non-blocking on the main thread). The current hacks are dependent on execution order - they need to run before everything else has finished activating. So I'll need to bump the minimum required Atom version once this lands in a stable release. |
Just as an update, I'm getting 671ms on my latest startup time for a relatively small (10K SLoC) project. So I'd love to see a fix for this happen! |
On my system, it takes 160ms. The lowest level is here: atom/lib/service/icon-delegate.js Line 245 in cfb2a1c
Can't we improve these? |
@aminya During loading, the package has to run almost 2,000 regular expressions against every filename that's visible in the workspace. It's already memoising each result to reduce overhead, and the expressions are compiled ahead of time to reduce duplication. All things considered, 160ms is actually pretty decent. If you can think of a better way to optimise 6,636 lines of filetypes, I'd like to hear it. |
Thank you for your answer! May I ask which algorithm checks the regular expressions? |
Yes, it's pure JavaScript. |
Doing a quick check with a simple algorithm, it takes 15ms for my Julia code to check 100 words against a 2000 regex list (word length of 7 for example). |
What's your point, exactly? |
I am saying that the time can be improved by using a better algorithm unless the issue is the slowness of the frontend API (creation of the icons shapes). |
I don't know what algorithms V8 uses for its regular expression matching. It's probably a hybrid of several. Regardless, it's not something I have control over. 150ms versus 15ms is seriously too slow for you? |
FYI, the execution speed is tangential to the problem reported in this thread. Matching doesn't happen until after Execution speed is less of a concern because it typically happens in response to user activity, such as clicking a folder in the |
I do want to note that my slow startup time is on an older computer in need of repair - I/O is dog slow and the onboard hardware diagnostics report nothing except an unrelated battery issue that long pre-dated the I/O issues. So my 671ms is probably equivalent to about 1/4 that for an equivalent working laptop. Separately, why on earth did Atom not make package initialization async? </rant> |
@isiahmeadows I'm in the same boat with an ancient MacBook and an equally ancient Dell laptop with almost non-existent battery life (both have low-density screens too, which seriously sucks when you're preparing vector images for icon display). Unfortunately I've no money to afford a new one...
Heh. Wouldn't be the first time I've asked that myself. 😉 |
Well, it is 10X speed up. This is a huge improvement for me.
If loading of the Again, my suggestions is based on a quick glance at the repo. I don't know the codebase. |
And you're suggesting we add a hard dependency on a runtime library that we actually don't need? Just for a negligible performance improvement? 10× sounds like a lot, but you're talking about pre-cache execution at startup (when every icon visible in the workspace causes a simultaneous filename/icon lookup, causing ostensibly heavy CPU usage). Furthermore, the time saved by using
I already have one in mind, but I haven't started work on it yet. But I'd like to hear your thoughts on how you'd implement it. |
If Atom doesn't provide an easy way to use C, C++ code, that explains all of its performance issues |
Slight correction: it only explains some of its performance issues. Package code can use native add-ons, but doing so requires extra tooling that users may or may not have available. In addition, new versions of Atom will usually require each native add-on to be recompiled, and all-in-all, the payoff simply isn't worth it. In conclusion, the performance issues aren't to do with V8's perceived inability to match strings efficiently (in fact, its string-handling is quite performant). It's more to do with I/O and blocking startup than anything else. |
Added an issue describing the situation and the needs for a better user experience. |
You mentioned WASM. WebAssembly is different to C/C++ bindings; it can be precompiled and checked into this package like ordinary source code, eliminating the potential edge-cases I described earlier. However, I'm still not about to turn this project on its head to eek out a few drops of performance that may or may not benefit every user. I'm still confused as to what the real problem you're trying to solve is. |
Well, the native addons are just a wrapper around the actual code. For example:
|
I know what the Moreover, if I were to take the WASM route, I'd just rewrite the entire damn library in ISO C so it could be called from Atom and any other program. In fact, that's actually what I already plan to do (eventually). Until then, I'd rather limit changes to this codebase to only those which are important, like making I/O calls async (which has proven to be difficult enough already). Getting this package to a point of stability took a lot of work and hair-pulling, and that's not something I'm eager to repeat when the payoff is infinitesimal. |
I added a couple of patches to solve this issue. #814, #815, #805 are among those. These reduced the loading time from about More PRs are coming. I have made it If we optimize the JavaScript code itself, we can gain a lot even without touching WASM. |
This is 4th on my list at 140ms. Dunno if anything can be improved, just wanted to let you know.
[email protected].
The text was updated successfully, but these errors were encountered: