Skip to content

perf(bench): optimize benchmark server#1073

Merged
0x676e67 merged 3 commits intomainfrom
bench
Feb 17, 2026
Merged

perf(bench): optimize benchmark server#1073
0x676e67 merged 3 commits intomainfrom
bench

Conversation

@0x676e67
Copy link
Owner

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @0x676e67, 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 significantly enhances the benchmark suite by introducing compiler-level optimizations for benchmark builds, refactoring the core server implementation for improved control and maintainability, and fine-tuning various benchmark parameters to ensure more relevant and efficient performance measurements. These changes collectively aim to provide a more robust and accurate benchmarking environment.

Highlights

  • Benchmark Build Optimization: Added a [profile.bench] section to Cargo.toml to enable specific compiler optimizations (opt-level=3, codegen-units=1, incremental=false) for benchmark builds, aiming to improve benchmark accuracy and performance.
  • Benchmark Server Refactoring: The benchmark server logic in bench/support/server.rs has been significantly refactored into Server and Handle structs. This change centralizes server configuration and lifecycle management, potentially leading to more robust and efficient benchmark execution.
  • Benchmark Parameter Adjustments: The CONCURRENT_LIMIT for benchmarks was increased from 100 to 150, and the NUM_REQUESTS_TO_SEND for TLS benchmarks was raised from 300 to 500. Additionally, the largest body sizes (8MB and 16MB) were removed from BODY_CASES to focus on more common payload sizes.
  • Improved Benchmark Labeling and Argument Consistency: Updated the Tls enum's display format to use 'https'/'http' for clearer output. Argument order for tls_mode and http_mode was standardized across benchmark functions, and benchmark label generation was refined for better readability.
Changelog
  • Cargo.toml
    • Added [profile.bench] configuration to optimize benchmark compilation with opt-level = 3, codegen-units = 1, and incremental = false.
  • bench/http1.rs
    • Introduced a TLS_MODE constant set to Tls::Disabled.
    • Updated calls to bench::bench_server_single_thread and bench::bench_server_multi_thread to pass TLS_MODE before HTTP_MODE.
  • bench/http1_over_tls.rs
    • Increased NUM_REQUESTS_TO_SEND from 300 to 500.
    • Reordered TLS_MODE and HTTP_MODE constants.
    • Updated calls to bench::bench_server_single_thread and bench::bench_server_multi_thread to pass TLS_MODE before HTTP_MODE.
  • bench/http2.rs
    • Introduced a TLS_MODE constant set to Tls::Disabled.
    • Updated calls to bench::bench_server_single_thread and bench::bench_server_multi_thread to pass TLS_MODE before HTTP_MODE.
  • bench/http2_over_tls.rs
    • Increased NUM_REQUESTS_TO_SEND from 300 to 500.
    • Reordered TLS_MODE and HTTP_MODE constants.
    • Updated calls to bench::bench_server_single_thread and bench::bench_server_multi_thread to pass TLS_MODE before HTTP_MODE.
  • bench/support.rs
    • Modified the fmt::Display implementation for the Tls enum to output "https" for Tls::Enabled and "http" for Tls::Disabled.
  • bench/support/bench.rs
    • Increased CONCURRENT_LIMIT from 100 to 150.
    • Reduced the BODY_CASES array by removing the 8MB and 16MB body sizes.
    • Reordered parameters in run_benches, bench_server_single_thread, and bench_server_multi_thread functions to consistently pass tls_mode before http_mode.
  • bench/support/client.rs
    • Removed the explicit scheme variable and directly used the Tls enum's Display implementation in the URL format string.
    • Modified the make_benchmark_label format string to place tls mode first.
  • bench/support/server.rs
    • Refactored the server implementation by introducing Server and Handle structs.
    • Moved server creation, connection handling, and shutdown logic into methods of the new Server struct.
    • Removed the spawn_server and server_with_shutdown functions, integrating their functionality into the new Server and with_server structure.
    • Updated handle_connection to accept an Arc<Server> and call its serve method.
Activity
  • The pull request was opened by 0x676e67.
  • No comments or reviews have been recorded yet.
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 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 counter productive. 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.

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.

gemini-code-assist[bot]

This comment was marked as outdated.

@0x676e67 0x676e67 merged commit bd8cd36 into main Feb 17, 2026
23 checks passed
@0x676e67 0x676e67 deleted the bench branch February 17, 2026 08:06
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.

1 participant

Comments