Skip to content

Reduce allocations for parsed rules#1591

Merged
prymitive merged 1 commit intomainfrom
allocs
Oct 22, 2025
Merged

Reduce allocations for parsed rules#1591
prymitive merged 1 commit intomainfrom
allocs

Conversation

@prymitive
Copy link
Collaborator

No description provided.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request was validated by pint.

✔️ No problems found

Stats

Stat Value
Version v0.76.1-1-g8595eb46
Number of rules parsed 9
Number of rules checked 9
Number of problems found 0
Number of offline checks 0
Number of online checks 0
Checks duration 0

Problems

No problems reported

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.44%. Comparing base (9400b39) to head (8595eb4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1591   +/-   ##
=======================================
  Coverage   96.44%   96.44%           
=======================================
  Files         109      109           
  Lines       15160    15160           
=======================================
  Hits        14621    14621           
  Misses        400      400           
  Partials      139      139           

☔ 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.

@github-actions
Copy link

Benchmark diff:

goos: linux
goarch: amd64
pkg: github.com/cloudflare/pint/cmd/pint
cpu: AMD EPYC 7763 64-Core Processor                
                    │   old.txt    │              new.txt               │
                    │    sec/op    │    sec/op     vs base              │
GlobFinder-4          30.35m ± ∞ ¹   30.72m ± ∞ ¹       ~ (p=1.000 n=5)
GitFinder-4           384.1m ± ∞ ¹   388.9m ± ∞ ¹  +1.26% (p=0.008 n=5)
CheckRules-4           9.449 ± ∞ ¹    9.484 ± ∞ ¹       ~ (p=0.841 n=5)
RuleIsIdentical-4     5.955m ± ∞ ¹   5.944m ± ∞ ¹       ~ (p=0.690 n=5)
GetChecksForEntry-4   113.6m ± ∞ ¹   113.2m ± ∞ ¹       ~ (p=0.841 n=5)
geomean               149.4m         150.1m        +0.46%
¹ need >= 6 samples for confidence interval at level 0.95

                    │    old.txt    │                new.txt                │
                    │     B/op      │     B/op       vs base                │
GlobFinder-4          9.493Mi ± ∞ ¹   9.493Mi ± ∞ ¹       ~ (p=1.000 n=5)
GitFinder-4           19.23Mi ± ∞ ¹   19.23Mi ± ∞ ¹       ~ (p=0.841 n=5)
CheckRules-4          993.5Mi ± ∞ ¹   990.6Mi ± ∞ ¹       ~ (p=0.151 n=5)
RuleIsIdentical-4       0.000 ± ∞ ¹     0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
GetChecksForEntry-4   60.46Mi ± ∞ ¹   56.55Mi ± ∞ ¹  -6.46% (p=0.008 n=5)
geomean                           ³                  -1.39%               ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

                    │   old.txt    │               new.txt                │
                    │  allocs/op   │  allocs/op    vs base                │
GlobFinder-4          145.8k ± ∞ ¹   145.8k ± ∞ ¹       ~ (p=0.889 n=5)
GitFinder-4           185.3k ± ∞ ¹   185.3k ± ∞ ¹       ~ (p=0.254 n=5)
CheckRules-4          14.74M ± ∞ ¹   14.73M ± ∞ ¹       ~ (p=0.421 n=5)
RuleIsIdentical-4      0.000 ± ∞ ¹    0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
GetChecksForEntry-4   900.9k ± ∞ ¹   915.8k ± ∞ ¹  +1.65% (p=0.008 n=5)
geomean                          ³                 +0.32%               ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

pkg: github.com/cloudflare/pint/internal/parser
        │   old.txt    │            new.txt            │
        │    sec/op    │    sec/op     vs base         │
Parse-4   27.55m ± ∞ ¹   27.65m ± ∞ ¹  ~ (p=0.841 n=5)
¹ need >= 6 samples for confidence interval at level 0.95

        │    old.txt    │            new.txt             │
        │     B/op      │     B/op       vs base         │
Parse-4   8.547Mi ± ∞ ¹   8.548Mi ± ∞ ¹  ~ (p=0.690 n=5)
¹ need >= 6 samples for confidence interval at level 0.95

        │   old.txt    │            new.txt            │
        │  allocs/op   │  allocs/op    vs base         │
Parse-4   144.9k ± ∞ ¹   144.9k ± ∞ ¹  ~ (p=0.905 n=5)
¹ need >= 6 samples for confidence interval at level 0.95

pkg: github.com/cloudflare/pint/internal/parser/utils
               │   old.txt    │              new.txt               │
               │    sec/op    │    sec/op     vs base              │
LabelsSource-4   1.360m ± ∞ ¹   1.417m ± ∞ ¹  +4.20% (p=0.032 n=5)
¹ need >= 6 samples for confidence interval at level 0.95

               │    old.txt    │            new.txt             │
               │     B/op      │     B/op       vs base         │
LabelsSource-4   1.126Mi ± ∞ ¹   1.126Mi ± ∞ ¹  ~ (p=0.421 n=5)
¹ need >= 6 samples for confidence interval at level 0.95

               │   old.txt    │            new.txt            │
               │  allocs/op   │  allocs/op    vs base         │
LabelsSource-4   8.862k ± ∞ ¹   8.862k ± ∞ ¹  ~ (p=1.000 n=5)
¹ need >= 6 samples for confidence interval at level 0.95

pkg: github.com/cloudflare/pint/internal/promapi
                    │   old.txt    │              new.txt               │
                    │    sec/op    │    sec/op     vs base              │
QueryCacheOnlySet-4   101.9n ± ∞ ¹   102.8n ± ∞ ¹       ~ (p=0.222 n=5)
QueryCacheSetGrow-4   384.6n ± ∞ ¹   413.5n ± ∞ ¹       ~ (p=0.095 n=5)
QueryCacheGetMiss-4   16.39n ± ∞ ¹   16.37n ± ∞ ¹       ~ (p=1.000 n=5)
QueryCacheGC/0%-4     33.81µ ± ∞ ¹   34.37µ ± ∞ ¹       ~ (p=0.095 n=5)
QueryCacheGC/1%-4     34.68µ ± ∞ ¹   35.12µ ± ∞ ¹       ~ (p=0.548 n=5)
QueryCacheGC/10%-4    39.76µ ± ∞ ¹   39.11µ ± ∞ ¹       ~ (p=1.000 n=5)
QueryCacheGC/20%-4    68.16µ ± ∞ ¹   67.75µ ± ∞ ¹       ~ (p=0.548 n=5)
QueryCacheGC/25%-4    68.31µ ± ∞ ¹   67.75µ ± ∞ ¹  -0.82% (p=0.008 n=5)
QueryCacheGC/50%-4    66.11µ ± ∞ ¹   66.09µ ± ∞ ¹       ~ (p=0.421 n=5)
QueryCacheGC/75%-4    49.74µ ± ∞ ¹   49.63µ ± ∞ ¹       ~ (p=0.841 n=5)
QueryCacheGC/99%-4    49.84µ ± ∞ ¹   49.84µ ± ∞ ¹       ~ (p=0.841 n=5)
QueryCacheGC/100%-4   49.74µ ± ∞ ¹   49.01µ ± ∞ ¹       ~ (p=0.841 n=5)
geomean               10.11µ         10.16µ        +0.51%
¹ need >= 6 samples for confidence interval at level 0.95

                    │    old.txt    │                new.txt                │
                    │     B/op      │     B/op       vs base                │
QueryCacheOnlySet-4     64.00 ± ∞ ¹     64.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheSetGrow-4     136.0 ± ∞ ¹     139.0 ± ∞ ¹       ~ (p=0.413 n=5)
QueryCacheGetMiss-4     0.000 ± ∞ ¹     0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/0%-4       0.000 ± ∞ ¹     0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/1%-4       0.000 ± ∞ ¹     0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/10%-4      0.000 ± ∞ ¹     0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/20%-4    18.09Ki ± ∞ ¹   18.09Ki ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/25%-4    18.09Ki ± ∞ ¹   18.09Ki ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/50%-4    18.09Ki ± ∞ ¹   18.09Ki ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/75%-4      48.00 ± ∞ ¹     48.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/99%-4      48.00 ± ∞ ¹     48.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/100%-4     48.00 ± ∞ ¹     48.00 ± ∞ ¹       ~ (p=1.000 n=5) ²
geomean                           ³                  +0.18%               ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

                    │   old.txt   │               new.txt               │
                    │  allocs/op  │  allocs/op   vs base                │
QueryCacheOnlySet-4   1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheSetGrow-4   1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGetMiss-4   0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/0%-4     0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/1%-4     0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/10%-4    0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/20%-4    4.000 ± ∞ ¹   4.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/25%-4    4.000 ± ∞ ¹   4.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/50%-4    4.000 ± ∞ ¹   4.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/75%-4    1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/99%-4    1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
QueryCacheGC/100%-4   1.000 ± ∞ ¹   1.000 ± ∞ ¹       ~ (p=1.000 n=5) ²
geomean                         ³                +0.00%               ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

@prymitive prymitive merged commit 79ce703 into main Oct 22, 2025
21 checks passed
@prymitive prymitive deleted the allocs branch October 22, 2025 12:41
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.

2 participants