Skip to content

FEAT: Add CI perf baseline regression detection & insertmanyvalues benchmark#527

Open
bewithgaurav wants to merge 7 commits intomainfrom
bewithgaurav/insertmany-benchmark
Open

FEAT: Add CI perf baseline regression detection & insertmanyvalues benchmark#527
bewithgaurav wants to merge 7 commits intomainfrom
bewithgaurav/insertmany-benchmark

Conversation

@bewithgaurav
Copy link
Copy Markdown
Collaborator

@bewithgaurav bewithgaurav commented Apr 17, 2026

Work Item / Issue Reference

AB#44074


Summary

This pull request enhances the performance benchmarking process in the CI pipeline by adding support for baseline comparison and automated artifact publishing and retrieval. The main improvements are focused on making benchmark results reproducible and comparable across pull requests and main branch runs.

Performance benchmarking improvements:

  • The benchmark script (benchmarks/perf-benchmarking.py) is now run with --baseline benchmark_baseline.json --json benchmark_results.json arguments, enabling baseline comparison and outputting results in JSON format. [1] [2]

Artifact management for benchmarks:

  • Added a step to publish the current benchmark results (benchmark_results.json) as a pipeline artifact named perf-baseline-$(sqlVersion) when running on the main branch. This artifact serves as the baseline for future comparisons.
  • Added a step to download the latest baseline artifact from the main branch for pull request runs, enabling direct comparison of current benchmark results against the established baseline.

…n, CI artifact pipeline

- Add insertmanyvalues scenario (100K rows, 1000/batch, GH #500 repro)
- Add --baseline flag for 3-way comparison (main vs PR vs pyodbc)
- Add --json flag to save results for pipeline artifact consumption
- Publish benchmark results as CI artifact on main merge
- Download baseline artifact on PR runs for automatic regression detection
- Fix timing: time.time() -> time.perf_counter()
- Move connection setup outside timing window (measure execute+fetch only)
@github-actions github-actions Bot added the pr-size: large Substantial code update label Apr 17, 2026
Comment thread benchmarks/perf-benchmarking.py Dismissed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

📊 Code Coverage Report

🔥 Diff Coverage

100%


🎯 Overall Coverage

79%


📈 Total Lines Covered: 6677 out of 8449
📁 Project: mssql-python


Diff Coverage

Diff: main...HEAD, staged and unstaged changes

No lines with coverage information in this diff.


📋 Files Needing Attention

📉 Files with overall lowest coverage (click to expand)
mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.pybind.ddbc_bindings.h: 67.8%
mssql_python.row.py: 70.5%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.ddbc_bindings.cpp: 74.2%
mssql_python.pybind.connection.connection.cpp: 75.8%
mssql_python.__init__.py: 77.3%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 79.6%
mssql_python.connection.py: 85.2%

🔗 Quick Links

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

@bewithgaurav bewithgaurav marked this pull request as ready for review April 17, 2026 10:45
Copilot AI review requested due to automatic review settings April 17, 2026 10:45
Copy link
Copy Markdown
Contributor

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 enhances CI performance benchmarking by generating JSON benchmark outputs, adding optional baseline comparisons against main, and introducing an insertmanyvalues-style insert benchmark alongside existing fetch/query scenarios.

Changes:

  • Update CI to run benchmarks/perf-benchmarking.py with --baseline ... --json ... and publish benchmark results as a pipeline artifact.
  • Add logic to download a baseline artifact from the latest main run for PR comparisons.
  • Extend the benchmark script with baseline/JSON support, updated reporting, and a new insertmanyvalues benchmark scenario.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
eng/pipelines/pr-validation-pipeline.yml Runs benchmarks with baseline/JSON flags and adds publish/download artifact steps intended to enable baseline comparisons in CI.
benchmarks/perf-benchmarking.py Adds argparse-driven baseline + JSON I/O, improves output formatting, and adds an insertmanyvalues benchmark scenario.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread eng/pipelines/pr-validation-pipeline.yml
Comment thread eng/pipelines/pr-validation-pipeline.yml Outdated
Comment thread eng/pipelines/pr-validation-pipeline.yml Outdated
Comment thread benchmarks/perf-benchmarking.py Outdated
Comment thread benchmarks/perf-benchmarking.py Outdated
- Download and restore AdventureWorks2022 via docker cp + sqlcmd
- Install pyodbc and run perf-benchmarking.py with --baseline/--json
- Publish/download baseline artifacts (perf-baseline-macOS-SQL2022/SQL2025)
- Same pattern as Windows, adapted for Colima Docker
Comment thread eng/pipelines/pr-validation-pipeline.yml Dismissed
Comment thread eng/pipelines/pr-validation-pipeline.yml Fixed
Comment thread eng/pipelines/pr-validation-pipeline.yml Dismissed
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread eng/pipelines/pr-validation-pipeline.yml Outdated
Comment thread benchmarks/perf-benchmarking.py
Comment thread benchmarks/perf-benchmarking.py
Comment thread benchmarks/perf-benchmarking.py
Comment thread eng/pipelines/pr-validation-pipeline.yml
Comment thread eng/pipelines/pr-validation-pipeline.yml
Comment thread eng/pipelines/pr-validation-pipeline.yml Outdated
@bewithgaurav bewithgaurav changed the title FEAT: Add CI perf baseline regression detection & insertmanyvalues benchmark PERF: Add CI perf baseline regression detection & insertmanyvalues benchmark Apr 20, 2026
@bewithgaurav bewithgaurav requested a review from Copilot April 20, 2026 10:01
@bewithgaurav bewithgaurav changed the title PERF: Add CI perf baseline regression detection & insertmanyvalues benchmark FEAT: Add CI perf baseline regression detection & insertmanyvalues benchmark Apr 20, 2026
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread eng/pipelines/pr-validation-pipeline.yml
Comment thread benchmarks/perf-benchmarking.py
Comment thread benchmarks/perf-benchmarking.py
Comment thread eng/pipelines/pr-validation-pipeline.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-size: large Substantial code update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants