Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

modify long to bytes with benchmarks#30

Merged
NeatGuyCoding merged 1 commit intomainfrom
long-to-byte-benchmark
Oct 17, 2025
Merged

modify long to bytes with benchmarks#30
NeatGuyCoding merged 1 commit intomainfrom
long-to-byte-benchmark

Conversation

@NeatGuyCoding
Copy link
Owner

@NeatGuyCoding NeatGuyCoding commented Oct 17, 2025

Result:

Benchmark                               (testValue)   Mode  Cnt       Score       Error   Units
LongToBytesBenchmark.optimizedMethod              0  thrpt    5  341953.998 ±  1290.600  ops/ms
LongToBytesBenchmark.optimizedMethod              1  thrpt    5  494923.006 ± 14451.153  ops/ms
LongToBytesBenchmark.optimizedMethod            123  thrpt    5  246779.726 ±  3226.868  ops/ms
LongToBytesBenchmark.optimizedMethod          12345  thrpt    5  173904.831 ±  1019.761  ops/ms
LongToBytesBenchmark.optimizedMethod      123456789  thrpt    5   93918.635 ±   408.958  ops/ms
LongToBytesBenchmark.optimizedMethod  1760666224123  thrpt    5   61634.305 ±   516.401  ops/ms
LongToBytesBenchmark.originalMethod               0  thrpt    5  340011.077 ±  1307.073  ops/ms
LongToBytesBenchmark.originalMethod               1  thrpt    5  219453.469 ± 12794.860  ops/ms
LongToBytesBenchmark.originalMethod             123  thrpt    5   85637.985 ±  1450.208  ops/ms
LongToBytesBenchmark.originalMethod           12345  thrpt    5   90153.533 ±  1232.794  ops/ms
LongToBytesBenchmark.originalMethod       123456789  thrpt    5   69504.474 ±   502.885  ops/ms
LongToBytesBenchmark.originalMethod   1760666224123  thrpt    5   57477.330 ±   917.341  ops/ms

Summary by CodeRabbit

  • Tests
    • Updated benchmark test configurations to enhance performance measurement accuracy and refine test parameters for improved system behavior evaluation.

Signed-off-by: NeatGuyCoding <15627489+NeatGuyCoding@users.noreply.github.com>
Copilot AI review requested due to automatic review settings October 17, 2025 02:10
@coderabbitai
Copy link

coderabbitai bot commented Oct 17, 2025

Walkthrough

This PR refactors the LongToBytesBenchmark test class with import consolidation, adjusts JMH benchmark configuration metrics from AverageTime to Throughput, recalibrates warmup and measurement durations, and updates a test parameter value.

Changes

Cohort / File(s) Summary
Benchmark Test Refactoring
netty-socketio-core/src/test/java/com/corundumstudio/socketio/benchmark/LongToBytesBenchmark.java
Replaced wildcard JMH imports with explicit imports; switched benchmark mode from AverageTime (nanoseconds) to Throughput (milliseconds); increased warmup duration from 1s to 2s; increased measurement duration from 1s to 5s with iterations reduced to 5; updated final test parameter value from 1234567890123456 to 1760666224123.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

The changes involve straightforward configuration adjustments and parameter updates to a benchmark test. Reviewers should verify JMH configuration parameter semantics and confirm the test parameter change is intentional, but the edits themselves are direct and low-complexity.

Possibly related PRs

Poem

🐰 Benchmarks hop faster now, with fresh metrics in sight,
Throughput measured true, warmup warms just right,
Parameters tweaked, imports arranged with care,
A speedier course for tests fair and square! 🏃‍♂️✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "modify long to bytes with benchmarks" is related to the changeset, which involves modifications to the LongToBytesBenchmark.java file. The title correctly identifies the subject matter (long-to-bytes conversion) and that it concerns benchmarks, which are the core elements of the change. However, the title is somewhat vague about what specifically was modified—it could be interpreted as suggesting changes to the conversion logic itself rather than to the benchmark configuration and parameters. The phrasing is partially specific; while a teammate would understand this relates to benchmark work on a long-to-bytes function, the title doesn't clearly convey that the main changes are to benchmark configuration (mode and timing), warmup/measurement parameters, and test input values.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch long-to-byte-benchmark

📜 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 1ef5f53 and 3479061.

📒 Files selected for processing (1)
  • netty-socketio-core/src/test/java/com/corundumstudio/socketio/benchmark/LongToBytesBenchmark.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
netty-socketio-core/src/test/java/com/corundumstudio/socketio/benchmark/LongToBytesBenchmark.java (1)
netty-socketio-core/src/main/java/com/corundumstudio/socketio/protocol/PacketEncoder.java (1)
  • PacketEncoder (33-399)
⏰ 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 (21) / build
  • GitHub Check: build (17) / build
🔇 Additional comments (3)
netty-socketio-core/src/test/java/com/corundumstudio/socketio/benchmark/LongToBytesBenchmark.java (3)

18-29: LGTM: Import consolidation improves clarity.

The explicit JMH annotation imports and TimeUnit addition are appropriate for the benchmark configuration changes below.


40-44: Configuration changes align with throughput measurement goals.

The switch from AverageTime/NANOSECONDS to Throughput/MILLISECONDS changes the metric from "time per operation" to "operations per millisecond," which matches the benchmark results in the PR description. The increased warmup time (2s) and longer measurement duration (5s) should provide more stable results, though the reduction from 10 to 5 measurement iterations slightly decreases statistical confidence.


48-48: Verify the test parameter change rationale.

The last test value was reduced from 1234567890123456 (16 digits) to 1760666224123 (13 digits), removing the largest input case. While the benchmark results in the PR description use this new value, it's unclear why the larger test case was removed. Larger values provide better stress-testing of the length calculation logic in both implementations.

Consider retaining both values to ensure comprehensive testing across the full range of supported inputs, or document the reason for removing the 16-digit test case.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modifies the JMH benchmark configuration for the LongToBytesBenchmark class to better measure throughput performance. The changes switch from average time measurement to throughput measurement and adjust benchmark parameters.

Key Changes:

  • Changed benchmark mode from AverageTime (nanoseconds) to Throughput (ops/milliseconds)
  • Adjusted warmup and measurement iteration parameters for more robust results
  • Replaced wildcard import with explicit imports for better code clarity

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@NeatGuyCoding NeatGuyCoding merged commit 852f5a8 into main Oct 17, 2025
4 checks passed
@NeatGuyCoding NeatGuyCoding deleted the long-to-byte-benchmark branch October 17, 2025 03:41
This was referenced Oct 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants