Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » clangd
clangd [message #57515] Thu, 16 September 2021 08:49 Go to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Moving the discussion from github. This was said:

Quote:

I use clangd (actually, ccls language server) with U++ for several years.
I use it from vim. This works very well for me.
Opening of a project takes about 10-15 sec on a 8 core (16 threads) CPU.
Navigation is much better than in TheIDE.
Language server spends ~1-2 sec. recompiling a file on each save operation.
I'd recommend to take a look at tree-sitter, which is an incremental parsing library.
Both, language server and tree-sitter are built into a new version of vim called neovim, which I recommend to use as a reference example.
We can also move this discussion to a U++ forum.


WRT speed, I am more concerned about what happens when I change some Core header...
Re: clangd [message #57522 is a reply to message #57515] Thu, 16 September 2021 18:42 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
When I open a project and Core was changed, it takes ~70 sec. to reindex a project (~16 min. of total CPU time).
When there is nothing to reindex, then opening (checking and loading of indexes) a project takes ~10 sec.


Regards,
Novo

[Updated on: Thu, 16 September 2021 19:04]

Report message to a moderator

Re: clangd [message #57523 is a reply to message #57522] Thu, 16 September 2021 19:02 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
Links:
ccls - C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited.
NeoVim.
NeoVim plugins:
Navigator - Navigate codes like a breeze. Exploring LSP and Tree-sitter symbols a piece of cake.
completion-nvim - A async completion framework aims to provide completion to neovim's built in LSP written in Lua.


Regards,
Novo
Re: clangd [message #57524 is a reply to message #57522] Thu, 16 September 2021 23:43 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Novo wrote on Thu, 16 September 2021 18:42
When I open a project and Core was changed, it takes ~70 sec. to reindex a project (~16 min. of total CPU time).
When there is nothing to reindex, then opening (checking and loading of indexes) a project takes ~10 sec.


How big is project? (Is CtrlLib in?)

Mirek
Re: clangd [message #57525 is a reply to message #57524] Fri, 17 September 2021 00:06 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
mirek wrote on Thu, 16 September 2021 17:43
Novo wrote on Thu, 16 September 2021 18:42
When I open a project and Core was changed, it takes ~70 sec. to reindex a project (~16 min. of total CPU time).
When there is nothing to reindex, then opening (checking and loading of indexes) a project takes ~10 sec.


How big is project? (Is CtrlLib in?)

Mirek

I'd say it is tiny Rolling Eyes
It took me a couple of hours to make it.
And yes, CtrlLib is included.
I've been talking about this project.


Regards,
Novo
Re: clangd [message #57526 is a reply to message #57525] Fri, 17 September 2021 00:19 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
I checked performance on a non-gui app.
Completely reindex: 5 min. of total CPU time.
Load an already indexed project: 1:30 min. of total CPU time.
This is acceptable on a 8-core (16 threads) cpu.
Basically, this is speed of compilation.


Regards,
Novo
Re: clangd [message #57527 is a reply to message #57526] Fri, 17 September 2021 00:20 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
Well, this non-gui app uses a lot of complicated templates.
So, compilation speed can be slow.


Regards,
Novo
Re: clangd [message #57528 is a reply to message #57527] Fri, 17 September 2021 00:25 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
The project itself opens up immediately. Language Server loads info in background asynchronously.
Navigation is disabled till LS finishes its job.


Regards,
Novo
Re: clangd [message #57535 is a reply to message #57528] Fri, 17 September 2021 16:15 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
You can check performance by yourself.
clangd:
--compile-commands-dir=<string> - Specify a path to look for compile_commands.json. If path is invalid, clangd will look in the current directory and parent paths of each source file

ccls:
--index=<root>        - standalone mode: index a project and exit

Do not forget to run "umk -j" to create a compile_commands.json file.


Regards,
Novo
Re: clangd [message #57536 is a reply to message #57535] Fri, 17 September 2021 18:49 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Novo wrote on Fri, 17 September 2021 16:15
You can check performance by yourself.
clangd:
--compile-commands-dir=<string> - Specify a path to look for compile_commands.json. If path is invalid, clangd will look in the current directory and parent paths of each source file

ccls:
--index=<root>        - standalone mode: index a project and exit

Do not forget to run "umk -j" to create a compile_commands.json file.


Could you do that for theide?

BTW, that could mean that BLITZ could still work in that context, right?

Mirek
Re: clangd [message #57537 is a reply to message #57536] Fri, 17 September 2021 21:09 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
mirek wrote on Fri, 17 September 2021 12:49

Could you do that for theide?

I do not really understand what you mean by that.
Quote:

BTW, that could mean that BLITZ could still work in that context, right?

Mirek

Correct. Everything that can be compiled with Clang can work in this context.
Just instead of real compilation you need to log Clang commands into a compile_commands.json file.

Current implementation of a "-j" option is not using BLITZ. Most likely, I did that because I couldn't figure out how to do that in umk, and after initial version begun to work I switched to another "let's make it work" project.


Regards,
Novo
Re: clangd [message #57538 is a reply to message #57537] Fri, 17 September 2021 22:52 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Novo wrote on Fri, 17 September 2021 21:09
mirek wrote on Fri, 17 September 2021 12:49

Could you do that for theide?

I do not really understand what you mean by that.


Can you test how long it takes to process theide project (complete, like after Core change)?

Mirek
Re: clangd [message #57539 is a reply to message #57538] Fri, 17 September 2021 23:55 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
mirek wrote on Fri, 17 September 2021 16:52
Novo wrote on Fri, 17 September 2021 21:09
mirek wrote on Fri, 17 September 2021 12:49

Could you do that for theide?

I do not really understand what you mean by that.


Can you test how long it takes to process theide project (complete, like after Core change)?

Mirek

I'll try. Time should be similar to compilation in Debug configuration (optimization is disabled).


Regards,
Novo
Re: clangd [message #57540 is a reply to message #57539] Sat, 18 September 2021 00:17 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
ccls: 34:30 of total CPU time. Not very fast Rolling Eyes
Memory usage up to 2.7 GB.
It is a heavy tool.


Regards,
Novo
Re: clangd [message #57541 is a reply to message #57540] Sat, 18 September 2021 00:20 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
Well, parallelization was almost 100%.

Regards,
Novo
Re: clangd [message #57542 is a reply to message #57540] Sat, 18 September 2021 00:31 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Novo wrote on Sat, 18 September 2021 00:17
ccls: 34:30 of total CPU time. Not very fast Rolling Eyes
Memory usage up to 2.7 GB.
It is a heavy tool.


Needs BLITZ...
Re: clangd [message #57543 is a reply to message #57541] Sat, 18 September 2021 00:43 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
Clang-based indexers are good when you do not have anything else, but they are very slow and memory-hungry.
Theoretically, they should have an ideal quality, but I often have problems with them, starting with inability to compile code from time to time (actually, quite often).
In case, when Clang fails, I just use regular search in project's folders.
But when it works, it is pretty good Rolling Eyes
A trick is not to save a file very often to prevent reindexing ...


Regards,
Novo
Re: clangd [message #57544 is a reply to message #57542] Sat, 18 September 2021 13:46 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1363
Registered: December 2006
Ultimate Contributor
mirek wrote on Fri, 17 September 2021 18:31

Needs BLITZ...

A catch: you have to add all used h-files to compile_commands.json explicitly.


Regards,
Novo
Re: clangd [message #57573 is a reply to message #57544] Thu, 30 September 2021 08:18 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Novo wrote on Sat, 18 September 2021 13:46
mirek wrote on Fri, 17 September 2021 18:31

Needs BLITZ...

A catch: you have to add all used h-files to compile_commands.json explicitly.


If you send me compile_commands with h-files, I can fix that I think (I mean, add them during compile_commands generation).

Mirek
Re: clangd [message #57574 is a reply to message #57573] Thu, 30 September 2021 12:57 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
After thinking about it for a while, I decided that I am not going to add clangd to TheIDE _myself_:

- it is quite a lot of work
- it does not meet my requirements for speed
- most importantly, I believe that people that want this would actually be even happier with Visual Studio Code (or some other "normal" IDE/editor). To integrate U++ with it seems to be much less work that to add clangd to TheIDE.
- U++ semiheuristic parser is work in progress, but it is MUCH faster than "real compiler" and the current architecture is fine in regards of what it can achieve. I believe that adding missing features to it is in the end less work that to integrate clangd. And much more fun too Smile

That said, if somebody wants to have a try at this, I will be more that happy to watch the progress!

Mirek
Previous Topic: about unicode supporting
Next Topic: Compilation on Mac
Goto Forum:
  


Current Time: Thu Jun 13 15:47:45 CEST 2024

Total time taken to generate the page: 0.02676 seconds