kuilpd wrote: I did some benchmarks of DIL on Unreal Engine 5 (thousands of variables to search through) and noticed that our current variable lookup implementation is ~10 times slower than it was in `lldb-eval`, especially when it comes to global variables in other files. I looked into it and made some changes: 1. Removed the code for lookups in the specific scope: we don't have an interface or any other code to pass the scope into variable lookup, so it is unused for now and cannot even be tested. 2. Shortened the code in `DILFindVariable` to stop at the first full match or return any partial match found. 3. Replaced the the call to `DILFindVariable` with `variable_list->FindVariable` in local variable search: we don't need full/partial matching checks since there is no namespaces and `::` in the variables in the local scope. 4. Search through local+global variables is now through globals of the current file only, without locals: reduces the amount to search through and allows to search a global variable that has the same base name as a local one. I also wanted to completely remove this step, because the later search through all globals in all files includes the current file as well (and this was the logic in `lldb-eval`, no search through current file globals). However, this slows down lookup if we search for a global in the current file, but also speeds up the lookup if we search for a global in a different file, and I'm not sure which tradeoff is better. Since current `frame var` doesn't have an ability to search through other files, I'm guessing the faster search in the current one is more important, at least for now. 5. Removed the entire LookupStaticIdentifier: I think there was a misunderstanding here while adapting the code from `lldb-eval`, this was the function that used to search through all global variables, and now here in the upstream it iterated through the current file variable list again but via a different interface, which is much slower and caused most of the slowdown. Its original functionality is at the end of `LookupGlobalIdentifier` that searches through all global variables, now also doing partial matching via `DILFindVariable`.
Because of the extra search in the current file globals, DIL is now somewhat faster in searching variables in the current file and somewhat slower in searching variables in other files compared to `lldb-eval`. https://github.com/llvm/llvm-project/pull/146094 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits