Hacker News new | ask | show | jobs
by AshamedCaptain 18 days ago
The biggest issue with clangd (and a derivate like this) is that it is at least three orders of magnitude slower than non-clang based indexers like the old ones in Eclipse and Qt Creator. It used to be that I could index a huge codebase in a couple minutes; clangd takes days and therefore we have to trouble with stuff such as remote indices. Frankly, I'd trade anything in the world for a fast indexer that is NOT based on clang, even if it were not perfect (which is kind of the point).
4 comments

Are you sure? This is explicitly not a ‘derivative’ and has a fascinating coroutine with multiprocess architecture. I would not automatically expect it to be too slow.

I agree re the old ones though. But they did far less. This design is heavy on completing templates. That’s tricky!

I would assume they're referring to it being built on top of clang. While it does claim to have improved on some architectural decisions in clangd, and my testing of it today was indeed much better than clangd when it comes to handling modules in particular, at the end of the day the bottleneck for responsiveness remains by a distance the time it takes clang to recompiled a translation unit.
I think you should reconcile with Clang and hope that they can work on performance for LSP tasks, because while C++ 26 reflections does a lot of "conservative" things right, it also enabled consteval to create structures with novel shapes, so you need consteval in an indexer.

ie.

auto val = make_named<"x","y">(1, 2.3);

// val is now a struct with an integer field named x and a double field named y

For the IDE use case its not clear support for that is worth giving up realtime parsing speeds. Of cource you can try to have your cake and eat it too by compiling a fast but limit parser with clangd but then you are doubling your bug surface.
Clangd is slower precisely because it's very precise. The old indexers you mention, like the one in Eclipse CDT, never truly worked for me. They weren't that useful and were always lacking compared to IntelliSense. clangd was the first time the FOSS alternative truly matched and often trounced IntelliSense
Yeah I think this is exacerbated by the ever increasing complexity of the language. Anything using workarounds to avoid implementing a full frontend is just going to fall apart on modern code depending on the standard library.
Precisely. Clangd can successfully index the entirety of Unreal Engine for instance (after fixing how you generate compile_commands.json, and taking like 32 GB of RAM in the process), which is not a small feat. Let's see if this new kid can do the same, it has been indexing 43k files for 10 hours now so for one it is indeed slower than clangd, which took like only 5
Derivative?

    It is still built on LLVM/Clang, but unlike clangd and ccls, which are also Clang-based, clice was redesigned from the ground up to fix architectural problems that have gone unsolved in those servers for years.