Skip to content

Conversation

mcserep
Copy link
Collaborator

@mcserep mcserep commented Jul 8, 2025

Refactor 3 level nested query loop to 2 level.

@mcserep mcserep added this to the Upcoming Release milestone Jul 8, 2025
@mcserep mcserep self-assigned this Jul 8, 2025
@mcserep mcserep added this to Roadmap Jul 8, 2025
@mcserep mcserep added Kind: Refactor 🔃 Plugin: C++ Issues related to the parsing and presentation of C++ projects. Plugin: Metrics Issues related to the code metrics plugin. labels Jul 8, 2025
@github-project-automation github-project-automation bot moved this to In progress in Roadmap Jul 8, 2025
@mcserep mcserep requested a review from Copilot July 8, 2025 04:08
Copilot

This comment was marked as outdated.

@mcserep mcserep force-pushed the lackofcohesion-performance branch 2 times, most recently from 4676a2e to e9b78eb Compare July 8, 2025 10:41
@mcserep mcserep requested a review from Copilot July 8, 2025 10:41
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the lackOfCohesion metric calculation to reduce a three-level database query loop into a two-level in-memory filtering, improving overall performance.

  • Combine per-method AST node queries into one batched query.
  • Collect methods first, build a single nodeQuery via OR clauses, fetch all nodes, then filter in memory.
  • Extend CohesionCppAstNodeView with start/end positions and filePath fields to support the new query.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
plugins/cpp_metrics/parser/src/cppmetricsparser.cpp Refactored nested queries into a combined query + in-memory filtering
plugins/cpp_metrics/model/include/model/cppcohesionmetrics.h Added AST node position and filePath columns to support filtering
Comments suppressed due to low confidence (1)

plugins/cpp_metrics/parser/src/cppmetricsparser.cpp:315

  • Add or update tests to verify that the refactored two-level loop produces the same cohesion metrics as the previous implementation.
          // Record these fields for later use.

@mcserep mcserep force-pushed the lackofcohesion-performance branch from e9b78eb to 3447677 Compare July 8, 2025 10:46
@mcserep mcserep merged commit d622a9c into Ericsson:master Jul 8, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Roadmap Jul 8, 2025
@mcserep mcserep deleted the lackofcohesion-performance branch July 25, 2025 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kind: Refactor 🔃 Plugin: C++ Issues related to the parsing and presentation of C++ projects. Plugin: Metrics Issues related to the code metrics plugin.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant