Skip to content

#503 Remove unnecessary tests for preprocessor directives.#504

Merged
sergisiso merged 2 commits into
masterfrom
503_more_efficient_cpp_parsing
Apr 27, 2026
Merged

#503 Remove unnecessary tests for preprocessor directives.#504
sergisiso merged 2 commits into
masterfrom
503_more_efficient_cpp_parsing

Conversation

@hiker
Copy link
Copy Markdown
Collaborator

@hiker hiker commented Apr 22, 2026

A small performance optimisation for parsing preprocessor directives. Originally, utils.c would test each cpp directive individually. With this small change, it will first see if the line actually starts with "#" before triggering these tests, which can greatly reduce the number of unnecessary tests.

I also moved matching of preprocessor lines after the test for endcls (since it should be more likely for any code to match the expected end directive than a preprocessor directives, which are all in all rather rare), which shaves of another 500 or so tests for one lfric example.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.21%. Comparing base (a197a85) to head (bd50fc6).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #504      +/-   ##
==========================================
- Coverage   92.21%   92.21%   -0.01%     
==========================================
  Files          87       87              
  Lines       13832    13831       -1     
==========================================
- Hits        12755    12754       -1     
  Misses       1077     1077              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hiker
Copy link
Copy Markdown
Collaborator Author

hiker commented Apr 22, 2026

Ready for review.

Copy link
Copy Markdown
Collaborator

@sergisiso sergisiso left a comment

Choose a reason for hiding this comment

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

@hiker I agree with this change, the code looks clearer and it does the right thing with the codes I tested it with.

@sergisiso sergisiso added ready for merge PR is waiting on final CI checks before being merged. and removed under review labels Apr 27, 2026
@sergisiso sergisiso merged commit 7d396b6 into master Apr 27, 2026
6 checks passed
@sergisiso sergisiso deleted the 503_more_efficient_cpp_parsing branch April 27, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ready for merge PR is waiting on final CI checks before being merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants