Improve Obsidian Startup Time on Older Devices with the FastStart Script
Obsidian is fast. This is one of the things it is known for; even when running on older or less powerful devices, it is speedy!
However, there is one tiny aspect of Obsidian that I have found to be slow, and that is the application’s startup time if you are using many plugins, like 25 or more.
In this article, I will demonstrate a hack I have been using to improve the startup speed of Obsidian on “slower” devices. This solution works on any platform supported by Obsidian, Windows, Android, Mac, Linux, iOS, etc.
While this hack works on all devices, the main goal is to improve startup on mobile devices, where startup speed makes the most significant difference.
Why improve the startup time of Obsidian?
First off, let me say that Obsidian is fast, and I am delighted with its performance. This should in no way be viewed as a criticism of Obsidian. Let us call it a personal itch that had to be scratched.
I run Obsidian on a few devices that are a few years old. Obsidian runs great on them, but I noticed that as I added more and more plugins, the program’s startup time took longer and longer as the number of plugins continued to increase.
On the PC, I don’t mind the few seconds of startup time, but on my iPhone 11 and my iPad Pro 2018, the startup time takes anywhere from 5 to 8 seconds. I know this is not much time, but we expect applications to start almost instantly when using mobile devices.
Mobile devices often have limited memory, so they will unload programs in the background when the system needs more memory. I found on my devices that Obsidian, when going into the background, frequently was unloaded and thus required a reload every time I returned to it.
For me, if there is even a subtle hint of delay, I experience subconscious friction, which subconsciously causes me to avoid using the program. If Obsidian Mobile doesn’t start almost immediately, I feel less inclined to use it. It is silly, but it is my reality.
Did I succeed?
On my iOS devices, the startup time was anywhere from 5 to 8 seconds, often more towards the latter.
Currently, my startup time is under 2 seconds, almost not even noticeable.
How did I accomplish this? Read on to find out.
But read on with one caveat: this is a reasonably involved hack that will require you to do some testing and tweaking on your own. This is not an install the hack, and it fixes everything for you.
If you don’t have the time to invest in shaving off a few seconds of your Obsidian startup time by reading these instructions carefully and doing your testing: STOP!!! And read something more useful like Eleanor’s fabulous Obsidian Roundup. But if you are courageous and crazy, please continue.
How Obsidian starts up
I will oversimplify what Obsidian does when it starts up, but it has to do several things to get Obsidian ready for use:
- Obsidian initializes its internal memory cache, a database of information about files in your vault.
- It loads the user interface the visual elements of the program (buttons, panes, workspaces, and so on).
- Obsidian starts loading the plugins one by one if you have enabled plugins.
The loading of the cache and user interface are very fast, even if you have a large vault. However, the loading of the plugins is what can take anywhere from milliseconds to a few seconds depending on the number of enabled plugins.
Interestingly, we can’t start to do any work until Obsidian completes these initializing steps.
However, I realized that many plugins I have installed I don’t use every day, and many I don’t need in the first few minutes of using Obsidian. Even so, I have to wait for all plugins to load each time Obsidian starts, even if they are not currently relevant to the task I want to do. This is more of an issue on mobile where the goal is quick capture or referencing information in your vault. These are simple goals, and having to wait is painful.
My approach to faster startup: FastStart script
It occurred to me if I could delay the startup of specific plugins until a little later after startup, perhaps the initial startup would be faster.
My theory goes as follow:
- Let Obsidian start, with just a few crucial plugins enabled.
- Obsidian loads fast because only a few plugins are enabled, and I can begin working with my files.
- While I am already working on files, after a brief timed delay, load the remainder of my plugins in the background while I am working.
To my surprise, this worked very well. Obsidian started much faster, and the plugins that started after a brief delay had no negative impact on performance while I was working.
I call this hack FastStart. Copyrights are pending.
How is this accomplished?
It turned out to be very simple. As I already mentioned, I enable just a few crucial plugins I need from when Obsidian first started.
One of these plugins enabled is the Templater plugin. Templater is a plugin for working with templates in Obsidian. Templater has two useful features:
- It can run a script file when Obsidian starts.
I call this script FastStart because it lets me start Obsidian faster on my older devices.
We need a few things to be set up and configured for this hack. Let’s do it step by step. Before giving detailed instructions, let me provide you with a simplified overview of what we are doing:
- Benchmarking: record the startup time of Obsidian on your devices before implementing this hack.
- Disabling most plugins (except Templater).
- Create a file with a list of plugin ID’s that start after 2 seconds.
- Create a second file with a list of plugin ID’s that start after 30 seconds.
- Experiment by moving plugins ID between the two lists.
Let us now go through these steps in detail.
Templater Plugin and the Templater Folder Location
First, in the Community Plugin settings screen of Obsidian, install the Templater Plugin.
After it is installed, open the settings for the Templater plugin, and in the Template folder location, set a local folder in your vault as the templates folder. This is the folder Templater uses to find all your templates and scripts. We are going to put our FastStart script in this folder.
In the file FastStart-StartupScript you just created, copy the script’s code into this file. Let me show you where the script’s code can be found. Go to this link. It contains the code we need. You should see this page in your browser after clicking on the link:
NOTE: It is important that this file contains nothing else, just the code you pasted into the file.
Now in the templates folder, as done in the previous step, create another file called FastStart-GenerateListOfInstalledPlugins.
Using the code from this link, paste it into this file you just created in your vault. The file should look like this in your vault:
FastStart-Plugins-ShortDelay and FastStart-Plugins-LongDelay
Next, in your vault, you need to create two more files. These files should not be in the templates folder used by Templater but can be stored anywhere in your vault that you like. Create these two files in your vault:
The name of each file should be exactly as it is named here. Currently, these files are empty.
Assign a Startup Template
Open the settings screen for the Templater plugin and find the section called Startup Templates. This is where you define a template or, in our case, a script file to be loaded by Templater when Obsidian starts.
To be clear, after Obsidian loads the Templater plugin, Templater will load any script defined here.
Click Add New Startup Template and set it to our FastStart-StartupScript file as shown in this screen:
Now when Templater starts up, the FastStart-StartupScript script file will be loaded.
We are ready to go
We have completed the initial setup of the files we need for the solution.
Before we go further, I suggest recording how long it takes Obsidian to load on all your devices.
This will serve as a baseline for comparing startup performance later. So if you have a desktop and a mobile phone, start Obsidian on each device and record the time it takes to startup in seconds.
What you want to test is not just Obsidian starting, but when Obsidian actually becomes useful so that you can edit a file.
There are two types of baselines that you might find helpful:
- Record how long it takes Obsidian to load with all your plugins enabled without any changes to your current configuration.
- It is also good to put your device into “Safe mode” in the Community Plugins settings screen and restart Obsidian. Record how long it takes while in safe mode. This baseline number is valuable because it shows you how long Obsidian takes with no plugins enabled, and frankly, we can’t change how much time Obsidian itself needs. So this baseline is the “minimum” startup time before any optimizations can be added.
You might also find it helpful to enable Debug startup time in Community Plugins settings. It provides feedback on how long plugins are taking to startup:
I would only caution with this feature; it is not a precise debugging tool. I found I got different results with each startup. But it was still valuable.
Now the fun begins. We need to experiment to find which plugins we want to start with Obsidian and which plugins should wait for a delayed startup. This is a process of trial and error.
FastStart is based on 3 phases of plugin startup:
- What plugins should load with Obsidian
- What plugins should start 2 seconds after Obsidian is loaded and you can already work with the program
- What plugins should load 30 seconds after the previous phase.
Again, the concept is that plugins are progressively loaded to optimize the startup time of Obsidian.
Step 1: Enable/Disable plugins that start with Obsidian
You need to open the plugin list in the Community Plugins settings screen. Make a list of all the plugins you have enabled.
Start disabling most of your plugins, just leaving the ones you think must start with Obsidian. For example, we need Templater to be enabled from startup.
For me personally, I have about five plugins that are enabled. The rest are disabled.
Step 2: Define what plugins should start a few seconds after Obsidian starts
Earlier, we created a file called FastStart-Plugins-ShortDelay. This file makes a list of all plugins that should start a few seconds after Obsidian has initialized.
In this file, I have defined the plugins I will likely need sooner than later, and plugins that I know don’t have a heavy performance impact on Obsidian.
In this file, you need to make a list of each plugin that should startup after a few seconds from when Obsidian has loaded. Each plugin should be on its own line, and the plugin ID should be listed in the file.
What is the plugin ID? Every plugin you have installed has a name and an identifier (or ID for short). We need to provide FastStart with the ID of the plugin since the ID is the unique way of identifying an installed plugin.
This is what my FastStart-Plugins-ShortDelay file looks like in my vault:
You probably recognize some of these plugins, but perhaps you have never seen their ID.
How can you get the plugin ID? This is where the FastStart-GenerateListOfInstalledPlugins script we made earlier comes into play. This Templater script will generate a list of all installed plugins and their plugin id.
To use this script, create a blank file in your vault. Then from the command palette, run the command Templater: Open Insert Template:
Then from the list of templates, choose FastStart-GenerateListOfInstalledPlugins.
This script should generate a file of all your plugins. Here is what my list looks like in Reading view in Obsidian:
From here, you can find the id of all your plugins.
Your job now is to add to the FastStart-Plugins-ShortDelay file in your vault the ID’s of the plugins you want to start a few seconds after Obsidian starts. Again, you can look at the screenshot I showed earlier from my vault to see what yours should look like.
Step 3: Define what plugins should start a little while later
Now we want to open the FastStart-Plugins-LongDelay file we created in our vault. This file will contain the remainder of the plugins we want to start, but just a little later. Here is what mine looks like:
As you can see, this file is similar to the FastStart-Plugins-ShortDelay. It is identical. It is a list of plugin ID’s.
NOTE: you can now move plugin ID’s between these two files, and you don’t need to repeat step 1 of disabling plugins in settings. I strongly suggest experimenting with testing plugins in various combinations to find the fastest way to load plugins for your devices, either in the file from step 2 or from step 3.
Measure the results
We have configured some plugins to start with Obsidian, other plugins to start a few seconds after Obsidian loads, and the remainder of the plugins a short time afterward.
Now restart Obsidian on your devices, and as you did earlier, measure the number of seconds it takes Obsidian to start.
Hopefully, you will see a noticeable performance boost on your devices on the application start.
Trial and Error
Each plugin is unique. As I went through this process, I experimented with when each plugin would be loaded.
There is only one rule: Templater must be enabled to start with Obsidian.
You will have to test the rest of the plugins to see when you want them to load.
NOTE: Some plugins don’t like to be started later, or just behave oddly. So in your experimentation, if a plugin is not behaving, enable it in settings so as have it start with Obsidian. Examples of plugins that don’t like a delayed startup: Custom Page Header and Title Bar, and Spaced Repetition.
If the startup time is not faster, you will need to experiment with how plugins load until it is loading faster. This process took me a few hours of experimenting, but as I mentioned, I now have a load time to be under two seconds.
Tweaking the timing
By default, these scripts load the first set of plugins after TWO seconds and the second after 30 seconds. These numbers are highlighted in this picture:
You can increase or decrease these delay times by changing the number. For example, on some slower devices, you might want to wait for 5 to 10 seconds after Obsidian starts, so change the number from 2 to 5.
I have now set these startup times to be 1 second and 5 seconds on my devices. I still get a speedy startup, and the plugins load in the background, and I don’t sense any performance hit. These iOS devices have good processors, and it seems that even this small delay of plugins loading at startup is all that is needed for an improved startup time.
As mentioned, this hack involves trial and error to tweak all these settings until they are optimized for your devices and your needs.
For me, the effort has paid off. Obsidian on my mobile devices starts very fast, and I no longer sense the subconscious mental friction to open Obsidian on my mobile devices.
I would appreciate hearing from you if you implement this hack. Please send me a tweet with the before and after benchmarks and any lessons you learned.