quamina icon indicating copy to clipboard operation
quamina copied to clipboard

kaizen: add analyzer, misc cleanup

Open timbray opened this issue 1 year ago • 1 comments

This adds the function analyze() to coreMatcher. It visits all of the fieldMatcher and valueMatcher states and gathers statistics (at the moment, just the maximum nondeterministic concurrency). For the moment, this is strictly an (extremely useful) tool for developers trying to optimize NFA construction/traversal.

Its output could be used in practice to increase the performance of the pathological case illustrated by TestShellStyleBuildTime(), which slows down to <10K/second when you add 13K wildcard patterns, but that particular optimization requires much more thinking.

No public API yet, but this could evolve into something similar to Ruler's MachineComplexityEvaluator public API although I'm not happy with the metric that API generates.

Also in this commit: Miscellaneous code cleanups including fixing a new lint problem detected by recent golangci-lint, and restoring tests that had been commented out because of the NFA state explosion.

timbray avatar Jun 28 '24 21:06 timbray

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 86.95652% with 6 lines in your changes missing coverage. Please review.

Project coverage is 96.48%. Comparing base (ec60e13) to head (21975ae).

Files Patch % Lines
field_matcher.go 42.85% 2 Missing and 2 partials :warning:
nfa.go 77.77% 2 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #326      +/-   ##
==========================================
- Coverage   96.54%   96.48%   -0.06%     
==========================================
  Files          18       18              
  Lines        1735     1764      +29     
==========================================
+ Hits         1675     1702      +27     
  Misses         35       35              
- Partials       25       27       +2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Jun 28 '24 21:06 codecov-commenter