# Why is slicer very slow to start the first time，but fast to start the second time？

**URL:** <https://discourse.slicer.org/t/why-is-slicer-very-slow-to-start-the-first-time-but-fast-to-start-the-second-time/31858>\
**Category:** Development\
**Created:** [September 23, 2023, 6:26am UTC](https://discourse.slicer.org/t/why-is-slicer-very-slow-to-start-the-first-time-but-fast-to-start-the-second-time/31858 "2023-09-23T06:26:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![icedream](https://avatars.discourse-cdn.com/v4/letter/i/48db29/32.png) [@icedream](https://discourse.slicer.org/u/icedream)\
**Post date:** [September 23, 2023, 6:26am UTC](https://discourse.slicer.org/t/why-is-slicer-very-slow-to-start-the-first-time-but-fast-to-start-the-second-time/31858/1 "2023-09-23T06:26:08Z")

</div>

Is there a way to quickly open Slicer after restarting the computer?

---

<div class="post-metadata">

**Author:** ![slicer365](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/slicer365/32/67549_2.png) [@slicer365](https://discourse.slicer.org/u/slicer365)\
**Post date:** [September 23, 2023, 7:42am UTC](https://discourse.slicer.org/t/why-is-slicer-very-slow-to-start-the-first-time-but-fast-to-start-the-second-time/31858/2 "2023-09-23T07:42:27Z")

</div>

Maybe you installed some modules and they need to download the specific python packages when first start.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [September 23, 2023, 2:52pm UTC](https://discourse.slicer.org/t/why-is-slicer-very-slow-to-start-the-first-time-but-fast-to-start-the-second-time/31858/3 "2023-09-23T14:52:37Z")

</div>

Slicer uses a lot of shared libraries, so depending on your platform they may need to be reloaded and cached after rebooting. What OS are you using?

---

<div class="post-metadata">

**Author:** ![icedream](https://avatars.discourse-cdn.com/v4/letter/i/48db29/32.png) [@icedream](https://discourse.slicer.org/u/icedream)\
**Post date:** [September 24, 2023, 3:52am UTC](https://discourse.slicer.org/t/why-is-slicer-very-slow-to-start-the-first-time-but-fast-to-start-the-second-time/31858/4 "2023-09-24T03:52:31Z")

</div>

thank you pieper , i use win11 for slicer , is it possible to cache the shared libraries in the background when the computer started use some script? these is friendly from some user who don’t familier with slicer.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 24, 2023, 12:59pm UTC](https://discourse.slicer.org/t/why-is-slicer-very-slow-to-start-the-first-time-but-fast-to-start-the-second-time/31858/5 "2023-09-24T12:59:41Z")

</div>

The easiest way to cache the binaries in memory would be to launch Slicer at startup with a script, without showing the application window. You can even make the application quit right after it started, but then if you use other applications then the binaries may be unloaded.

But there may be better ways to make Slicer available immediately when you need it (for example, using its server interface). Can you describe how you use Slicer and how the first longer startup time interferes with your workflow?

---

<div class="post-metadata">

**Author:** ![icedream](https://avatars.discourse-cdn.com/v4/letter/i/48db29/32.png) [@icedream](https://discourse.slicer.org/u/icedream)\
**Post date:** [September 24, 2023, 2:35pm UTC](https://discourse.slicer.org/t/why-is-slicer-very-slow-to-start-the-first-time-but-fast-to-start-the-second-time/31858/6 "2023-09-24T14:35:55Z")

</div>

i use SlicerCAT for some hight school for custom application , I make some customized plugins for professors according to their needs，Slicer is a very powerful foundational framework with strong stability and scalability，But the first startup speed was a bit slow, and one professor asked me how to solve it, but I couldn’t think of a good solution，So I came to the community to ask for help，thank you very much for reply @lassoan @pieper

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [September 24, 2023, 2:54pm UTC](https://discourse.slicer.org/t/why-is-slicer-very-slow-to-start-the-first-time-but-fast-to-start-the-second-time/31858/7 "2023-09-24T14:54:18Z")

</div>

Thanks for the extra background @icedream - if you are doing a custom app that only exposes a subset of features you might also want to disable any modules that you don’t need. CLI and Shared modules can be turned off in cmake lists files (just comment them out or delete them) and that may improve startup time, speed your build time, and make your redistribution binary smaller too.

Starting the application at boot or login time is an option that some commercial software uses, but that tends to slow down the computer overall even when the user isn’t using the app, so I don’t like that option much unless you’re sure your app is the main purpose of the computer.

---

<div class="post-metadata">

**Author:** ![icedream](https://avatars.discourse-cdn.com/v4/letter/i/48db29/32.png) [@icedream](https://discourse.slicer.org/u/icedream)\
**Post date:** [September 25, 2023, 3:11am UTC](https://discourse.slicer.org/t/why-is-slicer-very-slow-to-start-the-first-time-but-fast-to-start-the-second-time/31858/8 "2023-09-25T03:11:16Z")

</div>

thank you pieper for repsponse  
The first suggestion on reducing unnecessary plugins is very good. I have already applied it in the project, which can significantly reduce some loading time and software package size  
The second suggestion is that I cannot solve the problem. I have provided the professor with a computer that can only run the Slicer program. If i want to accelerate the startup time of the Slicer program, are there any suggestions?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [September 25, 2023, 1:52pm UTC](https://discourse.slicer.org/t/why-is-slicer-very-slow-to-start-the-first-time-but-fast-to-start-the-second-time/31858/9 "2023-09-25T13:52:18Z")

</div>

> [@icedream](#):
>
> I have provided the professor with a computer that can only run the Slicer program. If i want to accelerate the startup time of the Slicer program, are there any suggestions?

Since it’s a dedicated computer for this app, then setting it up so the app is loaded at startup or user login as @lassoan suggested makes sense. The total time will be about the same but it may feel faster to the user.

The other, more in-depth approach would be to profile the app and see where the time is taken. From previous experience I guess it’s loading shared libraries and creating the python bindings. If your custom app is or could be pure C++, then you could turn off python completely. It may also be possible to statically link much of the application, although that’s not the use case Slicer’s build and runtime systems are optimized for so you may hit some roadblocks.

---

<div class="post-metadata">

**Author:** ![icedream](https://avatars.discourse-cdn.com/v4/letter/i/48db29/32.png) [@icedream](https://discourse.slicer.org/u/icedream)\
**Post date:** [September 25, 2023, 2:10pm UTC](https://discourse.slicer.org/t/why-is-slicer-very-slow-to-start-the-first-time-but-fast-to-start-the-second-time/31858/10 "2023-09-25T14:10:06Z")

</div>

Thanks for your patience @pieper @lassoan  
in your advice i think i can do the speed work in two ways  
1.the quick way : start slicer when the computer start in no gui mode  
2.the in-depth way:print every step slicer function time cost ,Find which steps can be optimized to save time
