-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'JSON Compilation Database' sensor slow #2383
Comments
After having the job running overnight, the compilation database finally got parsed.
Has anyone witnessed a similar issue as well? |
Hi @guwirth, Our use case is that we generate the compilation database for our project and then we remove all compilation units we're not interested in. For example external libraries. |
Hi @thyros, Think there a several problems:
To 1: Are there a lot of files you don’t like/need to analyze?
Is the long time after removing ‘not interested’ includes? To better isolate the problem, can you play around with your Compilation Database:
By the way: How much LOC has the analyzed code base? Regards, |
Hi @thyros, Seems SonarSource is/was also working on a solution: Maybe they did some API extensions we can also use? But I still found “It is recommended to gather all your code tree in a subdirectory of your project to avoid analysing irrelevant source files like third party dependencies.” I understand this as reading everything below root? Regards, |
Hi @guwirth Sorry, I forgot to mention we also specify The size of the project is more or less like that: Regarding too many includes, that's something we can definitely look at. We could probably run include-what-you-use as a first step but anything more will require quite a lot of time. I can measure different configurations. |
Hi @thyros,
Means is than not an issue for you.
Comparable projects we are scanning in about 5 minutes.
Why these tests: 1. one try: without Compilation Database => resulting time? With this we can see if the Compilation Database is the issue or parsing the code is the issue. Forward an empty Compilation Database or remove https://github.com/SonarOpenCommunity/sonar-cxx/wiki/sonar.cxx.jsonCompilationDatabase parameter. 2. one try: https://github.com/SonarOpenCommunity/sonar-cxx/wiki/sonar.cxx.squid.disabled => resulting time? This is a test without parsing the code, reading only your reports. Maybe reading reports is slow?
Yes, to see if the Regards, |
Hi @thyros, maybe you can provide the LOG file or compilation database? Regards |
Hi @guwirth , |
Hi @guwirth, With
with the property enabled, I was not penitent enough to wait longer than 1 hour to have the scan finished. I managed to create a censored version of the log file. Maybe they can give us a hint. build.log Regards, |
H @thyros, thx for your investigations!
This could mean two things:
This is more an indication for 1).
The LOG file stops when it gets interesting. It's starting to parse the compilation database. This is also an indication for 1).
Is there something special in your compilation database? Can you provide the database for testing? sonar-cxx/cxx-squid/src/main/java/org/sonar/cxx/config/JsonCompilationDatabase.java Line 119 in 943957e
It should proceed like this:
Regards, |
Hi @thyros, in case you can’t provide the compilation database would be helpful to run it over night to have also the LOG items after Regards, |
Hi, I've attached a log from the sensor-cxx, obfuscated a bit but should still be readable. Regards, |
Hi @thyros, thank you very much.
First issue is reading the Json db needs nearly 50 min. I will analyse why this is so slow.
Second point could be optimized, is to move unique unit macros to global macros (which is set only once). Could be done in Json db sensor. Will have a look to it, but can take some time. Regards, |
- improve performance: search in XML tree with XPath is very slow (close SonarOpenCommunity#2383) - add better Visual Studio support - support apostrophes around arguments - support include paths with apostrophes - optimize parsing arguments
Root cause for slow JSON db reading is slow XPath search in CxxSquidConfiguration: sonar-cxx/cxx-squid/src/main/java/org/sonar/cxx/config/CxxSquidConfiguration.java Line 518 in c910f95
The problem occurs especially with many files (in sample above 4,921), because each file has its own entry in the XML file. XPath search works with an iterator that iterates many times serially over all elements. |
- improve performance: search in XML tree with XPath is very slow (close SonarOpenCommunity#2383) - add better Visual Studio support - support apostrophes around arguments - support include paths with apostrophes - optimize parsing arguments
@thyros We found the issue why the JSON DB sensor is so slow, #2410 makes it faster. Please try with latest snapshot and give feedback: https://github.com/SonarOpenCommunity/sonar-cxx/releases/tag/latest-snapshot |
Hi @guwirth, that's great news. I'll do my best to test your latest snapshot but it may take a while. |
Any chance to have a v2.0.8 with this fix? This bug caused more than one hour delay in our analysis runs... |
Hi @Kinokin, did you try https://github.com/SonarOpenCommunity/sonar-cxx/releases/tag/latest-snapshot with #2410? Should be faster... Regards, |
Use of un-versioned software is prohibited at our site :-( |
Hi @Kinokin, There is no difference between released versions and the snapshots. Both versions go through the same testing process and have a unique version number. Next release will be v2.1 with the next SQ 9.x LTS. Regards, |
Describe the bug
Hi, I'm trying to run sonar-cxx on my project.
I'm having problems getting it working when I set the
sonar.cxx.jsonCompilationDatabase
parameter.Looking at the logs the execution cannot pass the parsing step:
With the above parameter removed, the whole scan succeeds.
My compiler_commands.json is about 130KB and 35K lines.
Thanks
To Reproduce
Steps to reproduce the behavior:
compile_commands.json
using e.g. Ninja Generatorsonar.cxx.jsonCompilationDatabase
Expected behavior
Compilation Database is parsed and therefore source files are also parsed correctly
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: