Sublime Forum

Startup improvements

#1

Problem

I happen to usually have a large number of windows open when using Sublime Text (hence why I wrote https://packagecontrol.io/packages/GotoWindow). Currently I have a very modest number (37):

Anyway this leads to some problems for me. Sublime is able to handle it fine, but relaunching the application can be pretty painful. I have a fairly new mac (2.4 GHz Intel Core i7), but when Sublime launches it always uses up a lot of CPU and becomes unresponsive for usually around a minute or two. I am sure the fact that package control is running all the updates on startup is not helping either. I do not know anything about the internals of Sublime, but here are a couple of ideas I had:

Ideas

  • Offer a way for package control to process auto updates during regular usage instead of at startup (or after a delay).

    I rarely close and reopen Sublime so usually I have a lot of package updates that need to be processed on launch. This is frustrating because usually I am relaunching in order to install a Sublime update in which case my primary goal is to get back to writing code, and I would prefer if the package updates happened magically in the background. I am aware I can turn off the auto_upgrade setting, but I want auto upgrades, I just don’t want them to happen immediately after stratup.

  • Delay folder/file indexing until after you interact with a window

    I believe that Sublime indexes files in multiple windows in multiple threads on startup, but this actually makes the startup performance much worse for me. If I quit and reopen Sublime, I care most about being able to use the last project/window I had open when I closed it so I think that one should be given priority in terms of indexing. I would only index other windows if the CPUs are idle or if I explicitly focus that window to start working in it.

Thanks in advance!

0 Likes

#2

You might find Sesame useful.

Without Sesame I’d probably have as many windows open as you do, because with Sesame I can quickly open a folder or project, so it makes more sense to close windows that I don’t need that often.

The setup is easy, set your project locations:

{
    "sesame.path": "~/projects"
}

You can set multiple locations using directory path separator.

Then create some key bindings:

[
    { "keys": ["ctrl+alt+a"], "command": "sesame_add" },
    { "keys": ["ctrl+alt+o"], "command": "sesame_open" },
    { "keys": ["ctrl+alt+r"], "command": "sesame_remove" },
    { "keys": ["ctrl+alt+s"], "command": "sesame_switch" },
]

If you find yourself using Sesame a lot, then it might make sense to use a key binding like super+o to open folders and projects.

By default, Sesame looks for projects in the project locations in the format */* i.e. project/name. If you prefer a single level structure set the depth to 1:

{
    "sesame.depth": 1
}

You can also setup custom paths, for example I use one for a ~/vendor path:

[
    { "keys": ["ctrl+alt+v"], "command": "sesame_open", "args": { "path": "~/vendor" } },
]
0 Likes

#3

I realize this isn’t a direct solution to your problem, but have you tried using projects and the project switcher so you don’t need all of the windows open at the same time? It kind of sounds like your workflow is based this way anyway, since you just have these background windows around that you don’t want to do anything until you interact with them.

The project switcher will keep your files with edits preserved, layout, etc. This is how I like to switch around between disparate projects, and it results in never really needing more than 3-4 open at a time.

4 Likes

#4

I never use the project switcher. One reason is that you need to have already opened the project for it to be listed. This was the main motivation around writing Sesame. It lists all the projects found in the projects location and can open, add, switch, or remove any of them. It will also use a *.sublime-project file if one is found in the folder/project root so you don’t lose project state.

0 Likes

#5

@wbond thanks for the suggestion. I can give it a shot. The one issue is that sometimes I work with files/directories/code that do not have .sublime-project files which is why I wrote my window switcher package to begin with (cause the project switcher only works for projects that have been opened before that have *.sublime-project files as far as I can tell).

@gerry sesame actually looks pretty interesting as well. I will check it out! Thanks

0 Likes