• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ParadoxGameConverters / PGCG.commonItems / 23385239693

21 Mar 2026 05:49PM UTC coverage: 92.204% (-0.2%) from 92.365%
23385239693

push

github

web-flow
Parsing optimizations and optional parameter in Parser constructor (#799)

* Parsing optimizations

Parser lexeme single-char tokens now reuse static cached strings (=, {, }, ?) instead of char.ToString allocations.
Parser.ParseStream token history string builder made lazy (only allocates when broken =/?= state detected) to reduce active allocations and speed up common flow.
Parser.ParseFolder path now uses Directory.EnumerateFiles, precomputed extension HashSet, and one loop, replacing List+RemoveWhere overhead.
Parser.ParseGameFolder path now uses extension HashSet + manual loop + parsed-target list - eliminating extra LINQ Select and intermediate memory.
Regex rule replacement path upgraded from O(n) linear string scan to dictionary index mapping (regexRuleIndices), making register/replace faster.
Comment-skipping in parser parsing (# lines) now uses BufferedReader.SkipRestOfLine() to avoid ReadLine string allocations.
Added SkipRestOfLine() to BufferedReader.
Added benchmark harness commonItems.Benchmarks tests for all optimization candidates and confirmed runtime/allocation improvements.
dotnet build and dotnet test both passed.

Includes validated performance:
Single-char token ~22% speedup and ~83% allocation reduction
ParseStream history ~56% speedup and ~93% allocation reduction
ParseGameFolder ~19% speedup and ~26% allocation reduction
ParseFolder ~6% speedup and ~11% allocation reduction
Regex replace ~86% speedup (with expected small dictionary cost)

* Avoid using a regexRuleIndices dictionary

* Avoid looping the parser initialization in LoadScriptValues

* Add a parameter to Parser constructor

* Bump version

1279 of 1456 branches covered (87.84%)

Branch coverage included in aggregate %.

66 of 69 new or added lines in 4 files covered. (95.65%)

3 existing lines in 2 files now uncovered.

3795 of 4047 relevant lines covered (93.77%)

45530.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.0
/commonItems/Collections/ExtensionMethods.cs


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc