Skip to content

add parse functions#133

Merged
ReneWerner87 merged 8 commits intomasterfrom
add_parse_functions
Jul 11, 2025
Merged

add parse functions#133
ReneWerner87 merged 8 commits intomasterfrom
add_parse_functions

Conversation

@ReneWerner87
Copy link
Member

@ReneWerner87 ReneWerner87 commented Jul 11, 2025


Benchmark_ParseUint/fiber-12                  190390941	       6.292 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint/fiber-12                  187968758	       6.400 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint/fiber_bytes-12            181957326	       6.809 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint/fiber_bytes-12            182275550	       6.558 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint/default-12                 88281543	       13.52 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint/default-12                 88967146	       13.41 ns/op       0 B/op       0 allocs/op

Benchmark_ParseInt/fiber-12                   181353142	       6.723 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt/fiber-12                   180631305	       6.578 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt/fiber_bytes-12             175220041	       6.892 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt/fiber_bytes-12             171838354	       7.020 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt/default-12                  76055068	       15.77 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt/default-12                  75963992	       15.55 ns/op       0 B/op       0 allocs/op

Benchmark_ParseInt32/fiber-12                 179962680	       6.631 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt32/fiber-12                 181285437	       6.570 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt32/fiber_bytes-12           173786900	       6.901 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt32/fiber_bytes-12           171283489	       7.069 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt32/default-12                69845103	       15.75 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt32/default-12                76438194	       15.66 ns/op       0 B/op       0 allocs/op

Benchmark_ParseInt8/fiber-12                  286492362	       4.148 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt8/fiber-12                  282957276	       4.147 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt8/fiber_bytes-12            270179119	       4.481 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt8/fiber_bytes-12            258238294	       4.522 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt8/default-12                135063286	       8.831 ns/op       0 B/op       0 allocs/op
Benchmark_ParseInt8/default-12                140703313	       8.528 ns/op       0 B/op       0 allocs/op

Benchmark_ParseUint32/fiber-12                184411585	       6.568 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint32/fiber-12                184338627	       6.543 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint32/fiber_bytes-12          178475793	       6.759 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint32/fiber_bytes-12          178517788	       7.052 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint32/default-12               83775481	       13.41 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint32/default-12               88117585	       13.51 ns/op       0 B/op       0 allocs/op

Benchmark_ParseUint8/fiber-12                 401799110	       3.046 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint8/fiber-12                 380578648	       3.036 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint8/fiber_bytes-12           363442573	       3.344 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint8/fiber_bytes-12           357869246	       3.346 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint8/default-12               184238403	       6.788 ns/op       0 B/op       0 allocs/op
Benchmark_ParseUint8/default-12               186525054	       6.454 ns/op       0 B/op       0 allocs/op

Summary by CodeRabbit

  • New Features
    • Introduced new utilities for parsing strings and byte slices into various integer types, supporting both signed and unsigned formats.
  • Tests
    • Added comprehensive unit tests and benchmarks to validate correctness and measure performance of the new parsing utilities.
  • Documentation
    • Updated documentation with detailed benchmark results comparing the new parsing utilities to standard implementations.

@ReneWerner87 ReneWerner87 requested a review from a team as a code owner July 11, 2025 14:55
@ReneWerner87 ReneWerner87 requested review from gaby and removed request for a team July 11, 2025 14:55
@ReneWerner87 ReneWerner87 requested review from efectn and sixcolors July 11, 2025 14:55
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 11, 2025

"""

Walkthrough

A new generic integer parsing utility was introduced in the utils package, supporting signed and unsigned integer types with minimal code duplication. The update includes comprehensive unit tests, benchmarks comparing custom and standard library parsing, and README documentation of benchmark results for these parsing functions.

Changes

File(s) Change Summary
README.md Added benchmark results for new integer parsing functions, comparing custom and standard implementations.
utils/parse.go Introduced generic parsing functions and type constraints for signed/unsigned integers.
utils/parse_test.go Added table-driven unit tests and benchmarks for all new parsing functions, including performance comparisons.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant utils.ParseInt
    participant parseSigned
    participant parseDigits

    Caller->>utils.ParseInt: Call with input (string or []byte)
    utils.ParseInt->>parseSigned: Validate sign, bounds
    parseSigned->>parseDigits: Parse digits, check overflow
    parseDigits-->>parseSigned: Return value or failure
    parseSigned-->>utils.ParseInt: Return parsed int or error
    utils.ParseInt-->>Caller: Return value and success flag
Loading

Suggested labels

✏️ Feature

Suggested reviewers

  • gaby
  • sixcolors

Poem

A rabbit hopped through code anew,
Parsing numbers, quick and true!
With generics, types in line,
Benchmarks show the functions shine.
From bytes or strings, no bugs to find—
Now parsing’s swift, and tests are kind!
🐇✨
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 676629a and 9ae1b92.

📒 Files selected for processing (2)
  • parse.go (1 hunks)
  • parse_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • parse.go
  • parse_test.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build (1.24.x, windows-latest)
  • GitHub Check: Build (1.23.x, windows-latest)
  • GitHub Check: Build (1.23.x, macos-13)
  • GitHub Check: Compare
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add_parse_functions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @ReneWerner87, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a set of custom, high-performance integer parsing utilities to the utils package. The primary objective is to provide extremely fast and allocation-free methods for converting numerical strings or byte slices into various integer types, offering a significant performance uplift over standard library alternatives for applications requiring efficient parsing.

Highlights

  • New Parsing Functions: Introduced a suite of new, highly optimized ParseUint, ParseInt, ParseInt32, ParseInt8, ParseUint32, and ParseUint8 functions for converting decimal ASCII strings or byte slices to various integer types.
  • Performance Optimization: The new parsing functions are designed for high performance and zero allocations, demonstrating significant speed improvements (up to 2x-3x faster) compared to the standard library's strconv package, as evidenced by the included benchmarks.
  • Generic Implementation: The parsing logic leverages Go generics to support both string and []byte inputs for all integer parsing functions, enhancing flexibility and reusability.
  • Robustness: The new functions include robust handling for signs, overflow, underflow, and invalid characters, returning a boolean indicating success or failure.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Jul 11, 2025

Codecov Report

Attention: Patch coverage is 95.58824% with 3 lines in your changes missing coverage. Please review.

Project coverage is 96.01%. Comparing base (c5db933) to head (9ae1b92).
Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
parse.go 95.58% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #133      +/-   ##
==========================================
- Coverage   96.07%   96.01%   -0.06%     
==========================================
  Files           9       10       +1     
  Lines         535      603      +68     
==========================================
+ Hits          514      579      +65     
- Misses         14       16       +2     
- Partials        7        8       +1     
Flag Coverage Δ
unittests 96.01% <95.58%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a set of high-performance functions for parsing integers from strings and byte slices. The review focuses on improving the clarity of a subtle piece of logic and enhancing test coverage for critical edge cases.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
README.md (1)

138-178: Fix formatting: replace hard tabs with spaces.

The benchmark results contain hard tabs that should be replaced with spaces for consistency.

The benchmark results effectively demonstrate the performance improvements of the new parsing functions - the "fiber" implementations are consistently 2x faster than the default implementations with zero allocations.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c5db933 and 676629a.

📒 Files selected for processing (3)
  • README.md (1 hunks)
  • parse.go (1 hunks)
  • parse_test.go (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ReneWerner87
PR: gofiber/fiber#2864
File: ctx_test.go:4816-4816
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The `ParamsInt` function's behavior, including handling empty string parameters, will be addressed in future PRs as per ReneWerner87's guidance.
Learnt from: ReneWerner87
PR: gofiber/fiber#2864
File: ctx_test.go:4816-4816
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The `ParamsInt` function's behavior, including handling empty string parameters, will be addressed in future PRs as per ReneWerner87's guidance.
README.md (3)
Learnt from: juls0730
PR: gofiber/recipes#2710
File: tableflip/main.go:61-62
Timestamp: 2024-12-01T01:15:48.126Z
Learning: In the GoFiber `tableflip` recipe (`tableflip/main.go`), the implementation matches the upstream reference implementation. Future code suggestions should consider maintaining this alignment to ensure consistency.
Learnt from: ReneWerner87
PR: gofiber/storage#0
File: :0-0
Timestamp: 2025-02-12T11:24:31.153Z
Learning: The storage package in gofiber/storage repository can be used independently of the Fiber web framework.
Learnt from: ReneWerner87
PR: gofiber/fiber#3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.
parse_test.go (8)
Learnt from: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Learnt from: gaby
PR: gofiber/fiber#3056
File: middleware/encryptcookie/utils.go:22-25
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The `encryptcookie_test.go` file contains unit tests that validate key lengths for both `EncryptCookie` and `DecryptCookie` functions, ensuring that invalid key lengths raise appropriate errors.
Learnt from: gaby
PR: gofiber/fiber#3056
File: middleware/encryptcookie/utils.go:22-25
Timestamp: 2024-07-02T13:29:56.992Z
Learning: The `encryptcookie_test.go` file contains unit tests that validate key lengths for both `EncryptCookie` and `DecryptCookie` functions, ensuring that invalid key lengths raise appropriate errors.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: gaby
PR: gofiber/fiber#3170
File: ctx_test.go:1721-1724
Timestamp: 2024-10-16T12:12:30.506Z
Learning: In the Go unit tests in `ctx_test.go`, it is acceptable to use invalid CIDR notation such as `"0.0.0.1/31junk"` for testing purposes.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
🧬 Code Graph Analysis (1)
parse_test.go (1)
parse.go (6)
  • ParseUint (15-17)
  • ParseInt (21-23)
  • ParseInt32 (26-28)
  • ParseInt8 (31-33)
  • ParseUint32 (36-38)
  • ParseUint8 (41-43)
🪛 markdownlint-cli2 (0.17.2)
README.md

138-138: Hard tabs
Column: 56

(MD010, no-hard-tabs)


139-139: Hard tabs
Column: 56

(MD010, no-hard-tabs)


140-140: Hard tabs
Column: 56

(MD010, no-hard-tabs)


141-141: Hard tabs
Column: 56

(MD010, no-hard-tabs)


142-142: Hard tabs
Column: 56

(MD010, no-hard-tabs)


143-143: Hard tabs
Column: 56

(MD010, no-hard-tabs)


145-145: Hard tabs
Column: 56

(MD010, no-hard-tabs)


146-146: Hard tabs
Column: 56

(MD010, no-hard-tabs)


147-147: Hard tabs
Column: 56

(MD010, no-hard-tabs)


148-148: Hard tabs
Column: 56

(MD010, no-hard-tabs)


149-149: Hard tabs
Column: 56

(MD010, no-hard-tabs)


150-150: Hard tabs
Column: 56

(MD010, no-hard-tabs)


152-152: Hard tabs
Column: 56

(MD010, no-hard-tabs)


153-153: Hard tabs
Column: 56

(MD010, no-hard-tabs)


154-154: Hard tabs
Column: 56

(MD010, no-hard-tabs)


155-155: Hard tabs
Column: 56

(MD010, no-hard-tabs)


156-156: Hard tabs
Column: 56

(MD010, no-hard-tabs)


157-157: Hard tabs
Column: 56

(MD010, no-hard-tabs)


159-159: Hard tabs
Column: 56

(MD010, no-hard-tabs)


160-160: Hard tabs
Column: 56

(MD010, no-hard-tabs)


161-161: Hard tabs
Column: 56

(MD010, no-hard-tabs)


162-162: Hard tabs
Column: 56

(MD010, no-hard-tabs)


163-163: Hard tabs
Column: 56

(MD010, no-hard-tabs)


164-164: Hard tabs
Column: 56

(MD010, no-hard-tabs)


166-166: Hard tabs
Column: 56

(MD010, no-hard-tabs)


167-167: Hard tabs
Column: 56

(MD010, no-hard-tabs)


168-168: Hard tabs
Column: 56

(MD010, no-hard-tabs)


169-169: Hard tabs
Column: 56

(MD010, no-hard-tabs)


170-170: Hard tabs
Column: 56

(MD010, no-hard-tabs)


171-171: Hard tabs
Column: 56

(MD010, no-hard-tabs)


173-173: Hard tabs
Column: 56

(MD010, no-hard-tabs)


174-174: Hard tabs
Column: 56

(MD010, no-hard-tabs)


175-175: Hard tabs
Column: 56

(MD010, no-hard-tabs)


176-176: Hard tabs
Column: 56

(MD010, no-hard-tabs)


177-177: Hard tabs
Column: 56

(MD010, no-hard-tabs)


178-178: Hard tabs
Column: 56

(MD010, no-hard-tabs)

🪛 GitHub Check: codecov/patch
parse.go

[warning] 56-57: parse.go#L56-L57
Added lines #L56 - L57 were not covered by tests


[warning] 76-77: parse.go#L76-L77
Added lines #L76 - L77 were not covered by tests

🪛 GitHub Check: lint
parse.go

[failure] 108-108:
param max has same name as predeclared identifier (predeclared)


[failure] 65-65:
param max has same name as predeclared identifier (predeclared)


[failure] 65-65:
param min has same name as predeclared identifier (predeclared)


[failure] 3-3:
should only use grouped 'import' declarations (grouper)

🪛 GitHub Actions: golangci-lint
parse.go

[error] 3-3: golangci-lint: should only use grouped 'import' declarations (grouper)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build (1.23.x, windows-latest)
  • GitHub Check: Compare
🔇 Additional comments (13)
parse.go (4)

5-10: LGTM! Type constraints are well-defined.

The Signed and Unsigned type constraints correctly define the integer types supported by the parsing functions.


12-43: LGTM! Public API functions provide clean generic interfaces.

The parsing functions offer a consistent API across different integer types with proper delegation to internal helpers.


47-61: LGTM! Overflow detection logic is sound.

The parseDigits function correctly detects overflow by checking if nn < n after multiplication and addition.


66-104: Enhance test coverage for edge cases.

The static analysis indicates missing test coverage for overflow and underflow edge cases.

Consider adding test cases that specifically trigger:

  • Lines 56-57: overflow detection in parseDigits
  • Lines 76-77: handling of '+' prefix in signed parsing

This will improve code coverage and validate the edge case handling.

parse_test.go (9)

1-9: LGTM! Well-structured test file with proper imports.

The test file is well-organized with appropriate imports and follows Go testing conventions.


10-35: LGTM! Comprehensive test coverage for ParseUint.

The test cases cover valid inputs, invalid inputs, and edge cases for both string and byte slice inputs. The use of testify/require is consistent with project practices.


37-67: LGTM! Well-structured benchmark comparing implementations.

The benchmark properly compares the new parsing function against the standard library, testing both string and byte slice inputs with proper allocation reporting.


69-96: LGTM! Comprehensive test coverage for ParseInt including negative numbers.

The test cases appropriately cover signed integer parsing including negative values and edge cases like single "-" character.


130-156: LGTM! Excellent boundary testing for int32.

The tests properly validate overflow/underflow conditions at int32 boundaries (2147483647/-2147483648) and correctly expect failure for out-of-range values.


190-216: LGTM! Thorough boundary testing for int8.

The tests validate the int8 range limits (127/-128) and correctly handle overflow/underflow scenarios.


250-275: LGTM! Comprehensive uint32 testing with proper boundary validation.

The tests correctly validate the uint32 maximum value (4294967295) and properly reject negative inputs and overflow scenarios.


309-334: LGTM! Complete uint8 testing with boundary validation.

The tests properly validate the uint8 maximum value (255) and correctly handle overflow and negative input scenarios.


98-128: LGTM! Consistent and comprehensive benchmark structure.

All benchmark functions follow the same pattern, properly testing string input, byte slice input, and comparing against standard library implementations with allocation reporting.

Also applies to: 158-188, 218-248, 277-307, 336-366

@ReneWerner87 ReneWerner87 merged commit 3885eba into master Jul 11, 2025
18 checks passed
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