Skip to content
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

fix/3327/fix-parser-suggestions-slow #3329

Merged
merged 8 commits into from
Jun 7, 2023

Conversation

moritz-suckow-mw
Copy link
Collaborator

Speed up parser suggestions

Issue: #3327

Description

This PR aims to make the parser suggestions less slow and make the user aware that the shell did not crash when applicability is calculated.
To do this, some messages are logged when each parser finished checking for applicability and which folders are scanned for applicability.

Additionally some optimizations are done to increase the checking speed, especially for the MetricGardener.

@moritz-suckow-mw moritz-suckow-mw linked an issue Jun 2, 2023 that may be closed by this pull request
@moritz-suckow-mw moritz-suckow-mw changed the title Add multi token search to ResourceSearchHelper #3327 fix/3327/fix-parser-suggestions-slow Jun 2, 2023
@moritz-suckow-mw
Copy link
Collaborator Author

moritz-suckow-mw commented Jun 5, 2023

I did some testing:
In its current state, the parser suggestions need around 6 seconds to scan the CodeCharta directory (with build) on my pc.
With the new implementation it takes around 2-3 seconds.

Copy link
Collaborator

@ce-bo ce-bo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Though, added one a small remark.

@moritz-suckow-mw
Copy link
Collaborator Author

I refactored the ResourceSearchHelper because it was a "one class to fit all needs" implementation and was only tested by its users.

What I did was split the main function up into two separate functions, remove special cases which were only needed in edge cases for some of the using classes, add some additional validation to cover edge cases which were previously not thought of and add own unit testing for the ResourceSearchHelper.

Additionally I removed some unneeded operations which further sped up the parser suggestions.

# Conflicts:
#	CHANGELOG.md
#	analysis/import/SonarImporter/src/test/kotlin/de/maibornwolff/codecharta/importer/sonar/SonarImporterMainTest.kt
#	analysis/model/src/main/kotlin/de/maibornwolff/codecharta/util/ResourceSearchHelper.kt
#	analysis/parser/RawTextParser/src/test/kotlin/de/maibornwolff/codecharta/indentationlevelparser/RawTextParserTest.kt
Copy link
Collaborator

@ce-bo ce-bo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@sonarcloud
Copy link

sonarcloud bot commented Jun 7, 2023

[CodeCharta Analysis] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

96.6% 96.6% Coverage
0.0% 0.0% Duplication

@sonarcloud
Copy link

sonarcloud bot commented Jun 7, 2023

[CodeCharta Visualization] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@moritz-suckow-mw moritz-suckow-mw merged commit f48693b into main Jun 7, 2023
@moritz-suckow-mw moritz-suckow-mw deleted the fix/3327/fix-parser-suggestion-slow branch June 7, 2023 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parser Suggestions very slow
2 participants