Skip to content

set maxbufsize=start if start is larger than max - #3

Merged
kazeburo merged 2 commits into
mainfrom
fix/readme
Sep 21, 2026
Merged

kazeburo merged 2 commits into
mainfrom
fix/readme

Conversation

@kazeburo

@kazeburo kazeburo commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

PR Type

Bug fix, Tests


Description

  • Ensure maximum buffer size meets starting size

  • Update expansion limit test configuration


Diagram Walkthrough

flowchart LR
  Options["Scanner options"] --> Normalize["Normalize maximum buffer size"]
  Normalize --> Buffer["Initialize scanner buffer"]
  Tests["Buffer expansion tests"] --> Validation["Verify maximum-size errors"]
Loading

File Walkthrough

Relevant files
Bug fix
linebuf.go
Normalize scanner buffer size limits                                         

linebuf.go

  • Ensures MaxBufSize is at least StartBufSize.
  • Prevents invalid buffer configuration during initialization.
+1/-0     
Tests
linebuf_test.go
Correct maximum buffer expansion test                                       

linebuf_test.go

  • Configures both starting and maximum sizes.
  • Verifies expansion rejects tokens at the limit.
+1/-1     

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark Comparison

Base: main
PR: fix/readme

BenchmarkScan results
goos: linux
goarch: amd64
pkg: github.com/monitoring-forge/linebuf
cpu: AMD EPYC 9V74 80-Core Processor                
               │ base-bench.txt │            pr-bench.txt            │
               │     sec/op     │   sec/op     vs base               │
Scan_bufio-4        151.6µ ± 5%   152.1µ ± 2%       ~ (p=0.754 n=10)
Scan_linebuf-4      127.1µ ± 1%   122.4µ ± 1%  -3.65% (p=0.001 n=10)
Scan_iter-4         135.2µ ± 2%   134.2µ ± 0%       ~ (p=0.123 n=10)
geomean             137.6µ        135.7µ       -1.36%

               │ base-bench.txt │             pr-bench.txt              │
               │      B/op      │     B/op      vs base                 │
Scan_bufio-4       4.000Ki ± 0%   4.000Ki ± 0%       ~ (p=1.000 n=10) ¹
Scan_linebuf-4     4.062Ki ± 0%   4.062Ki ± 0%       ~ (p=1.000 n=10) ¹
Scan_iter-4        4.078Ki ± 0%   4.078Ki ± 0%       ~ (p=1.000 n=10) ¹
geomean            4.047Ki        4.047Ki       +0.00%
¹ all samples are equal

               │ base-bench.txt │            pr-bench.txt             │
               │   allocs/op    │ allocs/op   vs base                 │
Scan_bufio-4         1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Scan_linebuf-4       2.000 ± 0%   2.000 ± 0%       ~ (p=1.000 n=10) ¹
Scan_iter-4          3.000 ± 0%   3.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean              1.817        1.817       +0.00%
¹ all samples are equal

@github-actions

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

No code suggestions found for the PR.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

Standalone PR Review

PR-Agent could not safely update the persistent review. This standalone result will not replace the canonical review.

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

No code suggestions found for the PR.

@kazeburo
kazeburo merged commit 6fe3c19 into main Sep 21, 2026
4 checks passed
@kazeburo
kazeburo deleted the fix/readme branch September 21, 2026 08:08
@github-actions github-actions Bot mentioned this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant