Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Editor window startup is slow #2654

Closed
Closed

Description

@renatodex

Hi, i have used Textmate for a loong long time. But also as a big fan of new things, i decided to try Atom for curiosity purposes.

It turns out that i found Atom a great platform for day-by-day development, and im using it Atom now. But theres one thing annoying me:

I usually open Atom using the Shell command "atom [filename]", and compared to "mate [filename]" (the same command Textmate use for open files using Shell), Atom is incredible slow (i feel i have to wait twice of the time, like 1s~2s).
I know this performance also is related to machine specs, processors, memory and etc. But its the exactly same task executed for different tools.

I can record a video showing that behavior if you like.
Also, if this is a un-prioritize known issue, i can submit a pull request if theres noone working on it. I just need to know where to start looking.

][`s

Activity

  1. changed the title [-]Atom slower than Mate[/-] [+]Atom slower than Textmate[/+] on Jun 18, 2014
  2. benogle commented on Jun 18, 2014

    @benogle
    Contributor

    This is important to us, but we're not actively working on it right this second as we are focused on the react editor and windows support.

    Definitely look into this if you feel inclined. I would start with profiling, and the timeline.

  3. changed the title [-]Atom slower than Textmate[/-] [+]Startup time is slow[/+] on Jun 18, 2014
  4. changed the title [-]Startup time is slow[/-] [+]Editor window startup is slow[/+] on Jun 18, 2014
  5. renatodex commented on Jun 18, 2014

    @renatodex
    Author

    Great,
    Where i can learn more about the project structure?
    Should i dig into the code or there is some explanatory guide for starter contributors?

  6. benogle commented on Jun 18, 2014

    @benogle
    Contributor

    Before you start digging into this, you might be able to speed it up by disabling some packages.

    • Open time cop (cmd-shift-p search for time cop)
    • Or open atom --safe which opens with only core packages enabled

    Probably digging into the code would be easiest. If it were me, I would profile first, then for the slowest parts, dig around in that code and see what is going on.

    To create a profile for startup in https://github.com/atom/atom/blob/master/src/window-bootstrap.coffee you can programmatically start and end a profile:

    console.profile('Startup Time')
    ...
    console.profileEnd('Startup Time')
    
  7. benogle commented on Jun 18, 2014

    @benogle
    Contributor

    So add those lines, and open a dev window (atom -d in a code directory). Profile a couple different editor states, eg.

    • nothing open
    • a couple long files open
    • a split pane
    • non-git dir / git dir
    • etc
  8. renatodex commented on Jun 18, 2014

    @renatodex
    Author

    Thanks Ben, i appreciate your help!

  9. benogle commented on Jun 18, 2014

    @benogle
    Contributor

    Also, this is probably death by 1000 paper cuts. There will be no one thing that is a huge slowdown. With no files open and no treeview open, it opens in 500ms for me. With one medium size file and the tree view open, it takes ~1 second. There are 100 things involved with that extra 500ms. Reading the directory, Treeview rendering, reading the file, tokenizing, buffer rendering, etc. Each of those things might have small things to speedup.

    If you want to start small, the slowest builtin packages to load / activate are markdown preview and the treeview (they take a total of 150ms on my machine). Maybe there are things to speedup there?

  10. renatodex commented on Jun 18, 2014

    @renatodex
    Author

    Yeah, im looking into that right now. There are 67 core packages loading here. With atom --safe, 223ms was spent on packages loading (67 packages), and 262ms was spent on package activation (60 packages). At all, 485ms was spend on package loading and activation.

    I think the key point here is delay some packages to load after start. Because sometimes, the first essential is only content, identation and menu. Treeview, bracket matcher, markdown-preview, and even status bar are not theorically essential to see the raw contents of a given text file.

    Bottomline i agree with you, its death by 1000 paper cuts. But also, i think its a matter of loading things when they are really required. For instance, when you type "atom .", you are probably looking first for the whole structure of a given folder. But when you type "atom myfile.txt", you are probably looking first for the content of this file, so you probably wont worry about not having the Treeview on the first second. And its just that we are talking about, a single second.

    I dont know if its reasonable, what do you think?

    ][`s

  11. benogle commented on Jun 19, 2014

    @benogle
    Contributor

    Async loading of the packages has been talked about a lot in the past. There are some strong opinions about it. I can see the non-essential packages being loaded async. I'll try to dig up some of those old discussions tomorrow.

  12. lee-dohm commented on Jun 19, 2014

    @lee-dohm
    Contributor

    One thing that I've done with a few of my packages (even the small ones) is I've lazy-loaded everything possible. Like with my tabs-to-spaces package I create commands that first load the code and then executes it:

    TabsToSpaces = null
    tabsToSpaces = null
    
    module.exports =
      activate: ->
        atom.workspaceView.command 'tabs-to-spaces:tabify', ->
          loadModule()
          tabsToSpaces.tabify()
    
    # ... snip ...
    
    # Internal: Loads the module on-demand.
    loadModule = ->
      TabsToSpaces ?= require './tabs-to-spaces'
      tabsToSpaces ?= new TabsToSpaces()

    I've generally found that this kind of lazy-loaded package is faster (at least for initial startup) than using activationEvents from the Timecop view's perspective.

  13. countergram commented on Jul 24, 2014

    @countergram

    I just decided to try Atom on OS 10.8 on an (older) Macbook Pro and it is very slow. Opening a new window particularly. Timecop also drastically under-reports total window load time from the user perspective, and the sub-categories' times do not remotely add up to the total time, so I'm not sure where all the extra is coming from.

    E.g.: timecop usually shows a "window load time" of between 1500ms and 3000ms, although there was one 10000ms that I haven't been able to repeat so far. It seems highly variable. But my stopwatch (from the moment I run atom --safe from the command line) generally reads 4-8 seconds. This is with Atom running in the Dock so app startup is not included.

    For comparison running subl (or subl . which loads a files view) with Sublime Text 2 running in the Dock is practically instant. I cannot manually time it.

    When I have time I'll try the profiler code you mentioned.

  14. kevinsawicki commented on Jul 24, 2014

    @kevinsawicki
    Contributor

    @countergram The window load time is the time for that render process to load, there is a parent process that also loads when the app launches and creates the window> I'll add that time separately in TimeCop so they can be differentiated, thanks for mentioning this.

  15. 235 remaining items

  16. Jacalz commented on Nov 24, 2018

    @Jacalz

    To be quite honest, this is still really slow. Would like to see this improved dramatically, just look at vscode, it has way better startup time...

  17. stale commented on Nov 24, 2019

    @stale

    Thanks for your contribution!

    This issue has been automatically marked as stale because it has not had recent activity. Because the Atom team treats their issues as their backlog, stale issues are closed. If you would like this issue to remain open:

    1. Verify that you can still reproduce the issue in the latest version of Atom
    2. Comment that the issue is still reproducible and include:
      • What version of Atom you reproduced the issue on
      • What OS and version you reproduced the issue on
      • What steps you followed to reproduce the issue

    Issues that are labeled as triaged will not be automatically marked as stale.

  18. benwhalley commented on Jan 9, 2020

    @benwhalley

    It might be worth keeping this issue open as startup time is still not that snappy (latest build, OS X).

  19. MartinX3 commented on Aug 24, 2020

    @MartinX3

    Yes, it's way too much. (Latest build, Arch Linux)

  20. boredhero commented on Feb 9, 2021

    @boredhero

    Yeah, I'd just like to bump this as well and add my +1 (Latest build, Arch Linux). It's ridiculous that with an SSD, Ryzen 3600, Fury X, and 16GB of ram it takes ~5-7 seconds to launch atom. I primarily use atom to edit small files when nano won't cut it, but if it's going to take longer to open it than VSCode then it's not worth it.

  21. ThatXliner commented on Feb 9, 2021

    @ThatXliner
    Contributor

    Same. I use vim for extremely snappy edits, VS Code for debugging, and Atom for everything else. I hate vim. I really want to replace it with Atom. Is the init script execution already asynchronous?

  22. ventr1x commented on Sep 29, 2021

    @ventr1x

    5-7 seconds? On a maxed out Mac M1 it takes about 30 seconds. That's what we get for the decline of competency and the rise of cheap, fast packed web apps. Even in software dev people keep killing quality over easier and faster profits.

  23. Xaeroxe commented on Sep 29, 2021

    @Xaeroxe

    @ventr1x that's running emulated. Please reconsider your tone when making comments, you're not making friends or progress with that attitude.

  24. MartinX3 commented on Sep 29, 2021

    @MartinX3

    @Xaeroxe In our opinion these multi platform electron website apps are a step backwards in terms of cpu, ram, disk storage and battery usage. Electron apps running their own chromium browser.
    But hey, they are multi platform and html and javascript, etc.

  25. Xaeroxe commented on Sep 29, 2021

    @Xaeroxe

    I'm not here to talk about the performance of electron and whether it's good or bad. I'm here to remind people that

    1. Open source maintainers owe you nothing.
    2. Wandering into an issue tracker and calling everyone incompetent is never useful.

    If you don't like Electron, why are you here? There are non-Electron editors out there, and Atom is always going to be an Electron product. Changing that would require starting from scratch, at which point you're no longer hacking on Atom. I don't know what you're trying to accomplish by bringing the Electron discussion here.

  26. MartinX3 commented on Sep 29, 2021

    @MartinX3

    I dislike safe-spaces, they kill progress of any kind.
    So I write critics about stuff I tried, but not use anymore, because of its disadvantages.

  27. ventr1x commented on Sep 29, 2021

    @ventr1x

    It's not running "emulated".
    Electron supports M1 for over a year "natively" now.
    The same issue exists on my I9 MBP 2018.
    Other Electron apps (including ones I developed) do not, even remotely, have such issues - like the mentioned VSCode.

    Issues without solution, disccusions or ask for help - instead simple closures and shoving under the rug -, existing for 7+ years.. yep, I cannot call that a beacon of competence.

  28. icecream17 commented on Sep 29, 2021

    @icecream17
    Contributor

    It's more like there's not enough contributors. There's 7 pull requests right now and VSCode had 30+ commits today, so that's not a fair comparison. 7+ years is totally normal. In fact, I chose a random number between 1 and 100000, and this vscode issue took 1 year oof to resolve (probably worse than average but still) microsoft/vscode#28965.

    /rant (really unproductive comments here huh)

    Anyways...
    image

    I also used the javascript profiler in the console, and here's the results when I did the reload window command:
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions