Issue 244996
Summary `lldb` is slow to start up because of excessive open calls
Labels new issue
Assignees
Reporter collinfunk
    I noticed recently that `lldb` takes a long time to start. Interestingly, I was collecting the `--version` output for this bug report and noticed that the slow startup occurs there as well:

```bash
$ time lldb --version
lldb version 23.1.5

real 0m0.904s
user    0m0.198s
sys     0m0.704s
$ time gdb --version | head -n 1
GNU gdb (Fedora Linux) 18.1-1.fc45

real    0m0.070s
user 0m0.046s
sys     0m0.027s
```

The cause appears to be excessive `open` calls:

```bash
$ strace -c -e trace='/open' lldb --version >/dev/null
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 99.95    0.135957 10     13458        32 openat
  0.05    0.000063          63         1 open
------ ----------- ----------- --------- --------- ----------------
100.00    0.136020          10     13459        32 total
$ strace -c -e trace='/open' gdb --version >/dev/null
% time     seconds usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 97.92    0.002687           5 470       103 openat
  2.08    0.000057          57         1 open
  0.00    0.000000           0         1           pidfd_open
------ ----------- ----------- --------- --------- ----------------
100.00 0.002744           5       472       103 total
```

Looking at the actual `open` calls themselves, it seems `lldb` opens a ton of file descriptors to directories under `/usr/lib` and `/usr/lib64`:

```bash
$ strace -e trace='/open' lldb --version 2>&1 >/dev/null | grep -c '"/usr/lib.*O_DIRECTORY'
13346
```

This leads to opening a ton of things that aren't needed, e.g., Perl modules, QML documents, etc. Perhaps I have too much stuff installed...


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to