Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Code completion using LSP and clangd
ollydbg:
--- Quote ---I really do not know how to solves this situation without changing the legacy CC interface (cbeditor) for current users.
Legacy CC is used way more than clangd_client.
--- End quote ---
Hi, pecan, thanks for the work.
I see it is hard to solve this issue. If I remember correctly, the legecy code completion plugin does not use any markers. So, the issue is that the sdk(cb editor) need to supply more options for the markers.
christo:
Hi Pecan,
compile_commands.json is read and parsed every time a file is opened. This uses a lot of CPU, especially during the initial parsing of all files, where
compile_commands.json is read and parsed as many times as the number of files in the project. Attached patch does some optimisation for this.
1. Save the parsed compile_commands.json until the first batch parsing is completed, cleared after that.
2. After initial batch processing, all the filesnames are stored in a vector, and only if the filename is not present in this vector, compile commands is parsed. This helps to avoid parsing of the compile_commands.json after editing and saving of the file.
Thanks, Christo
ollydbg:
I see you have made several contribution to C::B. Either in this thread or in the compiler log parsing acceleration (High CPU usage during build operation when verbose is enabled)
Great job. But it is a bit hard for me to understand the patch's logic currently.
BTW: Can you show the CPU usage reduction before/after applying this patch? Thanks.
Pecan:
--- Quote from: christo on June 22, 2024, 11:41:29 am ---Hi Pecan,
compile_commands.json is read and parsed every time a file is opened. This uses a lot of CPU, especially during the initial parsing of all files, where
compile_commands.json is read and parsed as many times as the number of files in the project. Attached patch does some optimisation for this.
1. Save the parsed compile_commands.json until the first batch parsing is completed, cleared after that.
2. After initial batch processing, all the filesnames are stored in a vector, and only if the filename is not present in this vector, compile commands is parsed. This helps to avoid parsing of the compile_commands.json after editing and saving of the file.
Thanks, Christo
--- End quote ---
Thanks, I'll have a look and do some testing.
christo:
--- Quote from: ollydbg on June 23, 2024, 04:05:12 am ---BTW: Can you show the CPU usage reduction before/after applying this patch? Thanks.
--- End quote ---
@ollydbg Attaching perf output without and with the optimisation. perf is captured until full codeblocks project is parsed.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version