Skip to content

feat: Add jmh benchmarks for adaptive range reads.#277

Open
prudhvimaharishi wants to merge 1 commit into
GoogleCloudPlatform:feature/adaptive-range-readfrom
prudhvimaharishi:adaptive-6
Open

feat: Add jmh benchmarks for adaptive range reads.#277
prudhvimaharishi wants to merge 1 commit into
GoogleCloudPlatform:feature/adaptive-range-readfrom
prudhvimaharishi:adaptive-6

Conversation

@prudhvimaharishi

@prudhvimaharishi prudhvimaharishi commented May 19, 2026

Copy link
Copy Markdown
Contributor

Type of Change

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • chore: Changes to the build process or auxiliary tools and libraries such as documentation generation

Description

Jmh benchmarks for adaptive range reads.

What?

Modify jmh benchmarks for better visual understanding.

Why?

The existing benchmarks are confusing and does not cover all the use cases for adaptive range read. So modifying to reflect the same

Checklist

  • PR title follows Conventional Commits (e.g., feat(core): ...)
  • All files include the Apache License 2.0 header
  • Documentation has been updated to reflect changes

Generated/Assisted by Agent? [Yes/No]

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 updates the JMH benchmark suite for GCS adaptive range reads. The changes focus on improving the clarity and coverage of performance tests by replacing hardcoded seek scenarios with a more robust random read implementation and expanding the test parameters to include adaptive access patterns.

Highlights

  • Benchmark Refactoring: Replaced specific seek-based benchmarks with a generalized random read benchmark using a predefined set of offsets for better coverage.
  • Parameter Expansion: Added 'AUTO_SEQUENTIAL' and 'AUTO_RANDOM' to the FileAccessPattern parameters in GcsReadChannelBenchmarkState to support testing adaptive range read scenarios.
  • Performance Test Adjustments: Increased the data volume for sequential read benchmarks from 2MB to 8MB and optimized buffer management within the benchmark class.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the 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 may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

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.

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

Copy link
Copy Markdown
Contributor

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 refactors the GcsReadChannelBenchmark by replacing byte array buffers with a class-level ByteBuffer and introducing a randomRead benchmark that iterates through a set of predefined offsets. Additionally, the sequentialRead benchmark's data volume was increased, and new access patterns were added to the benchmark state. Review feedback suggests removing unused imports and modifying the randomRead implementation to handle partial reads, ensuring consistent data processing during benchmarking.

@codecov

codecov Bot commented May 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.08%. Comparing base (5057003) to head (f341835).

Additional details and impacted files
@@                      Coverage Diff                       @@
##             feature/adaptive-range-read     #277   +/-   ##
==============================================================
  Coverage                          98.08%   98.08%           
  Complexity                           282      282           
==============================================================
  Files                                 23       23           
  Lines                                836      836           
  Branches                              80       80           
==============================================================
  Hits                                 820      820           
  Misses                                 8        8           
  Partials                               8        8           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@prudhvimaharishi prudhvimaharishi marked this pull request as ready for review May 22, 2026 05:21
@prudhvimaharishi prudhvimaharishi requested a review from a team as a code owner May 22, 2026 05:21
@ajayky-os

Copy link
Copy Markdown
Contributor

We need better strategy for maintaining the jmh benchmarks, atleast for class level benchmarks. With addition of different parameters and benchmarks, it becomes time consuming to run all the jmh benchmarks in github runners or CI/CD pipelines.

@ajayky-os

Copy link
Copy Markdown
Contributor

Raise the PR in main branch since the feature in now merged in main branch

largeBuffer = new byte[100 * 1024];

localBuffer = ByteBuffer.allocate(64 * 1024);
offsets = new long[]{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This could be a static constant, rename it to be more meaningful. Eg: <READ_PATTERN>_OFFSETS.

stream.read(largeBuffer);
public void randomRead(GcsReadChannelBenchmarkState state) throws IOException {
for (long offset : offsets) {
localBuffer.clear();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

define localBuffer here itself, what is size of the localBuffer is interesting detail and is hidden here and one needs to search outside the spec.

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