<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/150220>150220</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            lldb-dap takes 3000ms instead of 120-400ms
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          LevoDeLellis
      </td>
    </tr>
</table>

<pre>
    There's a crashed that will happen but has been fixed (see https://discourse.llvm.org/t/is-lldb-dap-usable/87320/10)
I noticed lldb-dap takes a long time, so I tested against gdb (120ms) and codelldb which uses lldb (<400ms) but lldb-dap takes 3s, this is on linux. I haven't tried on other OSes

Put this in `/tmp/a.c` and compile with `clang a.cpp -g`
```
#include <stdio.h>
int main() {
        puts("Hello");
}
```

Save the dap file below as dap, make sure the line ending is saved as CRLF, then run `time cat dap | lldb-dap`, as mentioned it'll crash but thats been fixed. 

My real code measure time more accurately, doesn't suffer from the crash, uses better input (below omits threadid but the dap still appears to work) and waits for messages. Anyway, you can also test with gdb by writing `time cat dap | gdb --interpreter=dap` to confirm my numbers are accurate. For codelldb I wrote `cat dap | nc -l 127.0.0.1 -p 5547` which I press ctrl+c when I see seq 18 and I run codelldb by writing `time codelldb --connect 5547`. It's <1s, my proper code measures it in <400ms

The two main areas that are slow is replying to launch and the first stop event. Additional stop events didn't seem to suffer from delays


```
Content-Length: 370

{"seq":1,"type":"request","command":"initialize","arguments":{"clientID":"tester","clientName":"tester","adapterID":"lldb-dap","linesStartAt1":true,"columnsStartAt1":true,"supportsRunInTerminalRequest":false,"supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsMemoryEvent":true,"supportsStartDebuggingRequest":true}}Content-Length: 141

{"seq":2,"type":"request","command":"launch","arguments":{"type":"lldb","request":"launch","program":"/tmp/a.out","relativePathBase":"/tmp"}}Content-Length: 107

{"seq":3,"type":"request","command":"setFunctionBreakpoints","arguments":{"breakpoints":[{"name":"main"}]}}Content-Length: 71

{"seq":4,"type":"request","command":"configurationDone","arguments":{}}Content-Length: 61

{"seq":5,"type":"request","command":"threads","arguments":{}}Content-Length: 64

{"seq":6,"type":"request","command":"stackTrace","arguments":{}}Content-Length: 62

{"seq":7,"type":"request","command":"continue","arguments":{}}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycV9Fu4zoO_RrlhUhgy0ndPuQhTW6wAebuDjrzA7LF2NrKkkekk8l-_UJymqadphcoULSodUQeHh5KtiIyjUNcisWjWGwmauDWh-U3PPgNfkNrDU0qr0_Lny0GFLIkUFAHRS1q4FYxHI210Kq-RwfVwNAqggrRwd78Rg1C3hMitMw9iWIl5FbIrTZU-yEQzqw9dDMfGiG3LOTW0NRaXU216qcDqcqikNv7spCZkNs8E_JBZKsdOM-mRg0vWGD1jJGZ9a4BNh0KuQbysANGYtSgGmUcMTS6ipRymXUk5AMop6H2GmMkOLambmEgpBQ5AkWxnmdnbKzuXcaCYiJuDYEh8A6sccPvGeygVQd0QpYMHAzquOa5xQD_-YEkspXIVt8HPm91IO5ihdz1Qm7VrBZ32Zla1xuLcDTcRkxtlWtAzeq-h2kTN2Wr-Hv8yVZCFsbVdtAIolgTa-NnrSj-EtnKOIZOGReLkg8gysfE4qEfmNIz-S-01gspo8pFWi037-Nnqx_qgMAtQlRhH8lVaP0RFMUnUY5OPSPQEEaYNQ4BnTauiRqROsR2EKyfvm1H8dBBGJIEsXNQK06xRbm-yJ3kWcdtHTo23qEGw0KW1o5uTM2Jfrw23wxGyn-fIKCyqdHQoRq5xVydDwiqroegGO0p5tAeaWwcDfs9BtgH36VKUqIISQ6pkBkDGNcPHJ0yquA7wwTcBlTa6DOrUSviOClxUFQgYA9HH55fPHhUcd_eB-iQSDVIM1i501ElTic_QK0cKEs-OXo0RDRzdYJjMBzV_UjACJlOjWMMfUDGIIrNqGdkUHu3N6GD7gRu6CoMB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