# It there any way for lazyloading or progressing for root prompt now?

**URL:** <https://root-forum.cern.ch/t/it-there-any-way-for-lazyloading-or-progressing-for-root-prompt-now/62588>\
**Category:** Evolution Proposals, Apps & Ideas\
**Created:** [January 6, 2025, 9:19am UTC](https://root-forum.cern.ch/t/it-there-any-way-for-lazyloading-or-progressing-for-root-prompt-now/62588 "2025-01-06T09:19:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cxwx1](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/cxwx1/32/22433_2.png) [@cxwx1](https://root-forum.cern.ch/u/cxwx1)\
**Post date:** [January 6, 2025, 9:19am UTC](https://root-forum.cern.ch/t/it-there-any-way-for-lazyloading-or-progressing-for-root-prompt-now/62588/1 "2025-01-06T09:19:53Z")

</div>

Hi all:  
I’m trying to use ROOT prompt in neovim with [iron.nvim](https://github.com/Vigemus/iron.nvim)

But I include some heavy header in my project and `rootlogon.C`

I’d love to run these line with lazy mode. like  
[lazy.nvim](https://github.com/folke/lazy.nvim)  
[zinit]

for example,  
opening root prompt, running `include` 3 second later

How should I do.

timing test

```c++
gInterpreter->ProcessLine("#include <yaml-cpp/yaml.h>");
gInterpreter->ProcessLine("#include <sol/sol.hpp>");

```

```c++
#include <TInterpreter.h>
#include <TStopwatch.h>
#include <iostream>
using namespace std;

namespace {
void f1() {
  TStopwatch awatch;
  awatch.Start();
  gInterpreter->ProcessLine("#include <spdlog/spdlog.h>");
  awatch.Stop();
  cout << "spdlog:" << awatch.RealTime() << " " << awatch.CpuTime() << endl; // NOLINT
}
void f2() {
  TStopwatch awatch;
  awatch.Start();
  gInterpreter->ProcessLine("#include <yaml-cpp/yaml.h>");
  awatch.Stop();
  cout << "yaml-cpp:" << awatch.RealTime() << " " << awatch.CpuTime() << endl; // NOLINT
}
void f3() {
  TStopwatch awatch;
  awatch.Start();
  gInterpreter->ProcessLine("#include <sol/sol.hpp>");
  awatch.Stop();
  cout << "sol:" << awatch.RealTime() << " " << awatch.CpuTime() << endl; // NOLINT
}
} // namespace

void p2_header() { // NOLINT
  f1();
  f2();
  f3();
}

```

```result
spdlog:0.750646 0.75
yaml-cpp:0.176003 0.18
sol:0.717335 0.71 <- 0.71 second too slow

```

some relate

> [@Cling #include performance](https://root-forum.cern.ch/t/cling-include-performance/52402):
>
> Hi folks, this is related to topic [Speed up #include](https://root-forum.cern.ch/t/speed-up-include/18032) (I can’t link, since I’m new) [EDIT Axel: added link], but I didn’t know the necro rules and I have more to ask so I started a new topic. Overview I’m using Cling to build jank, a Clojure dialect for C++ with JIT compilation. I have jank-\>C++ codegen and Cling JIT compilation working well, but I’ve run into a troublesome performance issue on startup. My startup code for Cling looks like this: auto const jank\_location(jank::util::process\_loc…

> [@How to #include \<myownheader.h\> in rootlogon.C](https://root-forum.cern.ch/t/how-to-include-myownheader-h-in-rootlogon-c/55643/7):
>
> I use header yaml-cpp and spdlog, the two lib’s header cause long time loading whenever using Declare or ProcessLine ? can I speed up the without compiling the script?

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [January 7, 2025, 7:45am UTC](https://root-forum.cern.ch/t/it-there-any-way-for-lazyloading-or-progressing-for-root-prompt-now/62588/2 "2025-01-07T07:45:25Z")

</div>

> [@cxwx1](#):
>
> opening root prompt, running `include` 3 second later

Not sure I really understand your question and what you’re trying to achieve, but if you want to wait three seconds, you can simply add `gSystem->Sleep(3000)`

---

<div class="post-metadata">

**Author:** ![cxwx1](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/cxwx1/32/22433_2.png) [@cxwx1](https://root-forum.cern.ch/u/cxwx1)\
**Post date:** [January 9, 2025, 6:56pm UTC](https://root-forum.cern.ch/t/it-there-any-way-for-lazyloading-or-progressing-for-root-prompt-now/62588/3 "2025-01-09T18:56:06Z")

</div>

I think the question is equal to

If I’ve a long `rootlogon.C` file

```auto
{
    gSystem->Load("liba1.so");
    gSystem->Load("liba2.so");
    gSystem->Load("liba3.so");
....
   gInterpreter->ProcessLine("#include <h1.h>");
   gInterpreter->ProcessLine("#include <h2.h>");
.....
}

```

could I use

```auto
void loadLibrary(const char* libName) {
    sleep(1); // or wait a litter longer?
    gSystem->Load(libName);
    std::cout << "Loaded: " << libName << std::endl;
}

int main() {
   
    std::thread t1(loadLibrary, "liba1.so");
    std::thread t2(loadLibrary, "liba2.so");
    std::thread t3(loadLibrary, "liba3.so");

    
    t1.join();
    t2.join();
    t3.join();

    std::cout << "All libraries loaded!" << std::endl;

    return 0;
}

```

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [January 10, 2025, 7:12am UTC](https://root-forum.cern.ch/t/it-there-any-way-for-lazyloading-or-progressing-for-root-prompt-now/62588/4 "2025-01-10T07:12:00Z")

</div>

> [@cxwx1](#):
>
> could I use

Did you try?

---

<div class="post-metadata">

**Author:** ![cxwx1](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/cxwx1/32/22433_2.png) [@cxwx1](https://root-forum.cern.ch/u/cxwx1)\
**Post date:** [January 11, 2025, 6:57am UTC](https://root-forum.cern.ch/t/it-there-any-way-for-lazyloading-or-progressing-for-root-prompt-now/62588/5 "2025-01-11T06:57:40Z")

</div>

It seems OK for me now, but I’m not sure.
