Skip to content

CHORE: TEST PR Performance Report control path - #799

Draft
Gaurav Sharma (bewithgaurav) wants to merge 24 commits into
mainfrom
bewithgaurav/profiler-control-canary
Draft

Gaurav Sharma (bewithgaurav) wants to merge 24 commits into
mainfrom
bewithgaurav/profiler-control-canary

Conversation

@bewithgaurav

@bewithgaurav Gaurav Sharma (bewithgaurav) commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Work Item / Issue Reference

ADO Work Item: AB#44819


Summary

Disposable control canary for the merged PR Performance Report. This branch changes only an invisible README marker, so the report should complete across five environments without detecting a performance regression. This PR will not be merged.

Jahnvi Thakkar (jahnvi480) and others added 7 commits May 7, 2026 12:09
… on SUCCESS, __slots__ Row, and C++ Row construction - Cache decoding encoding strings in cursor __init__ to avoid 2 method calls + 2 dict.get() per fetch - Skip DDBCSQLGetAllDiagRecords on SQL_SUCCESS (ODBC spec: zero records on SUCCESS) - Replace param.encode('ascii') try/except with str.isascii() (C-level check) - Class-level _SQL_TO_C_TYPE lookup table (built once, shared across cursors) - Add __slots__ to Row class (eliminates per-instance __dict__, ~232 bytes/row savings) - Add Row._fast_create static method (bypasses __init__ for common case) - Add C++ construct_rows function (builds Row objects in tight C loop, avoiding Python loop overhead) - Zero-copy Row fast path when no converters/UUID processing needed Benchmark results (5-run average, richbench repeat=5 number=5): - Fetch one: -1.7x -> -1.4x (18% improvement) - Fetch many: -1.7x -> -1.3x (24% improvement) - 100 inserts: 4.9x -> 5.6x (14% faster) - SELECT: -1.1x -> -1.0x (on par with pyodbc) Profiler wall clock (50K rows): - fetchall: 176.7ms -> 158.1ms (11% faster) - fetchmany: 166.6ms -> 138.6ms (17% faster) No overlap with PR #549 (execute fast path) or PR #526 (simdutf).
Preserve late output converter fallback behavior and UUID conversion while retaining the no-converter fast path. Add regression and cache operation-count coverage for all fetch APIs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve fetch and Row conflicts while retaining current-main converter dispatch, lowercase column maps, profiling scopes, and CHAR decoding ctype. Extend fetch fast paths and regression coverage for the merged behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Validate the native row type argument, restore unconditional diagnostic retrieval, raise fetch errors before row processing, and retain fast paths when registered converters do not match. Add isolated crash and fetch contract regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve scalar SQL NULL values without suppressing fetch errors. Cover fixed-width types, LOB and bound fetch paths, literal NULL and OBJECT_ID results, and cursor recovery.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Create a disposable documentation-only change to validate the PR Performance Report end to end.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 18, 2026 06:22
@github-actions github-actions Bot added the pr-size: small Minimal code update label Sep 18, 2026
@github-actions

github-actions Bot commented Sep 18, 2026

Copy link
Copy Markdown

PR Performance Report

This PR has 4 consistent improvement signals across 2 database tasks and 2 environments.

Environment Affected task Before After Change
Unix / SQL Server 2022 Insertion with explicit input sizes 2411.298 ms 505.671 ms -79.6%
Unix / SQL Server 2022 1.2-million-row fetching 5048.741 ms 3496.130 ms -30.3%
Unix / SQL Server 2025 Insertion with explicit input sizes 2328.064 ms 428.398 ms -80.4%
Unix / SQL Server 2025 1.2-million-row fetching 5284.211 ms 3450.084 ms -34.0%

Coverage: 2 of 2 environments completed. Advisory result; does not block merging.

Environment Status
Unix / SQL Server 2022 Completed
Unix / SQL Server 2025 Completed
Affected phases and call counts

Phase times are inclusive diagnostics and must not be added together. They identify where measured time changed, not why it changed.

Unix / SQL Server 2022

Insertion with explicit input sizes: py::execute::cpp_call -35.979 ms; ddbc::SQLExecute_wrap -35.461 ms; ddbc::BindParameters -9.503 ms.
1.2-million-row fetching: py::fetchall::row_wrap -1582.804 ms; ddbc::FetchAll_wrap -2.772 ms; ddbc::FetchBatchData -2.742 ms.

Unix / SQL Server 2025

Insertion with explicit input sizes: py::execute::cpp_call -39.267 ms; ddbc::SQLExecute_wrap -38.696 ms; ddbc::BindParameters -5.345 ms.
1.2-million-row fetching: py::fetchall::row_wrap -1810.841 ms; ddbc::FetchBatchData::construct_rows -3.903 ms; py::fetchall::cpp_call -2.775 ms.

All database tasks and timings

Unix / SQL Server 2022

Database task Before After Paired change Result
Connection opening 10.925 ms 10.990 ms +2.0% no signal
SELECT queries 1.275 ms 1.130 ms -12.7% no signal
Row insertion 36.756 ms 35.460 ms -2.1% no signal
Executemany inserts 160.941 ms 162.738 ms +1.6% no signal
Fetch-all queries 175.299 ms 141.961 ms -17.6% no signal
Row-by-row fetching 60.657 ms 57.011 ms -5.9% no signal
Batched row fetching 166.519 ms 143.123 ms -14.5% no signal
Transaction commit and rollback 119.579 ms 117.539 ms -2.0% no signal
Arrow row fetching 105.969 ms 96.170 ms -7.9% no signal
100,000-row insertion 457.800 ms 446.350 ms -2.7% no signal
Row fetching in batches of 100 225.292 ms 196.418 ms -14.3% no signal
Row fetching in batches of 10,000 185.132 ms 164.188 ms -11.0% no signal
Repeated positional queries 43.427 ms 42.910 ms -1.0% no signal
Repeated named-parameter queries 45.771 ms 45.653 ms +0.2% no signal
Legacy 100,000-row insertion 356.290 ms 358.249 ms -0.2% no signal
Insertion with explicit input sizes 2411.298 ms 505.671 ms -79.6% consistent improvement
Joined aggregation queries 177.387 ms 179.804 ms +0.7% no signal
Large joined-result fetching 209.943 ms 200.717 ms -3.6% no signal
1.2-million-row fetching 5048.741 ms 3496.130 ms -30.3% consistent improvement
Common table expression queries 5.448 ms 5.447 ms -1.4% no signal

Unix / SQL Server 2025

Database task Before After Paired change Result
Connection opening 95.121 ms 96.329 ms +0.1% no signal
SELECT queries 1.162 ms 1.073 ms -6.3% no signal
Row insertion 31.493 ms 31.860 ms +1.2% no signal
Executemany inserts 136.383 ms 132.519 ms -4.6% no signal
Fetch-all queries 167.269 ms 134.834 ms -17.2% no signal
Row-by-row fetching 52.529 ms 49.629 ms -4.8% no signal
Batched row fetching 151.910 ms 132.099 ms -12.6% no signal
Transaction commit and rollback 102.192 ms 106.721 ms +4.2% no signal
Arrow row fetching 88.260 ms 90.731 ms +1.9% no signal
100,000-row insertion 394.324 ms 398.276 ms -1.5% no signal
Row fetching in batches of 100 196.767 ms 172.517 ms -12.6% no signal
Row fetching in batches of 10,000 170.302 ms 155.479 ms -10.7% no signal
Repeated positional queries 38.226 ms 38.171 ms -0.2% no signal
Repeated named-parameter queries 40.615 ms 40.469 ms -0.4% no signal
Legacy 100,000-row insertion 304.356 ms 311.129 ms +2.0% no signal
Insertion with explicit input sizes 2328.064 ms 428.398 ms -80.4% consistent improvement
Joined aggregation queries 161.639 ms 166.686 ms +3.4% no signal
Large joined-result fetching 205.818 ms 191.456 ms -6.7% no signal
1.2-million-row fetching 5284.211 ms 3450.084 ms -34.0% consistent improvement
Common table expression queries 5.262 ms 5.314 ms +0.7% no signal
Build, commits and measurement details

ADO build 177007

PR head: e1141c58ecacb6c9ede12adf31f9886f847946d4
Base: f3e34e66bca6d6f45d7a2cbea070c40ebe4ba194
Measured merge: 3b24afef89ae57daad8c92ad9bec71b483a885c7

  • Unix / SQL Server 2022: Python 3.12.3, x86_64, SQL 16.0.4295.3; 5 paired comparisons and 1 warmup.
  • Unix / SQL Server 2025: Python 3.12.3, x86_64, SQL 17.0.5005.3; 5 paired comparisons and 1 warmup.

A consistent change requires more than 20% median paired movement, at least 1 ms between the median runtimes, and at least 80% of pairs exceeding the relative threshold in the same direction. A slowdown without enough pair agreement is reported as inconsistent.

The displayed change is the median of paired before-and-after ratios. It is not recalculated from the two displayed median runtimes.

Both revisions use profiling-enabled builds on the same agent and database, with alternating order and discarded warmups. Results are diagnostic and do not represent production-wheel latency.

Raw samples and logs are attached to the ADO run as profiler-* artifacts.

Copilot AI 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.

🟢 Approval recommended

No unresolved issues; the change is limited to a non-rendered README marker.

Pull request overview

Adds an invisible README marker to validate the profiler report control path without changing product code.

Changes:

  • Adds an HTML comment canary to README.md.
File summaries
File Description
README.md Adds the invisible profiler control marker.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 18, 2026

Copy link
Copy Markdown

📊 Code Coverage Report

🔥 Diff Coverage

93%


🎯 Overall Coverage

84%


📈 Total Lines Covered: 8767 out of 10412
📁 Project: mssql-python


Diff Coverage

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

  • mssql_python/connection.py (100%)
  • mssql_python/cursor.py (100%)
  • mssql_python/pybind/ddbc_bindings.cpp (83.3%): Missing lines 3634-3636,3650-3652,3655
  • mssql_python/row.py (100%)

Summary

  • Total: 103 lines
  • Missing: 7 lines
  • Coverage: 93%

mssql_python/pybind/ddbc_bindings.cpp

Lines 3630-3640

  3630             case SQL_SMALLINT: {
  3631                 SQLSMALLINT smallIntValue;
  3632                 SQLLEN indicator = 0;
  3633                 ret = SQLGetData_ptr(hStmt, i, SQL_C_SHORT, &smallIntValue, 0, &indicator);
! 3634                 if (SQL_SUCCEEDED(ret) && indicator == SQL_NULL_DATA) {
! 3635                     row.append(py::none());
! 3636                     break;
  3637                 }
  3638                 if (SQL_SUCCEEDED(ret)) {
  3639                     row.append(static_cast<int>(smallIntValue));
  3640                 } else {

Lines 3646-3659

  3646                 break;
  3647             }
  3648             case SQL_REAL: {
  3649                 SQLREAL realValue;
! 3650                 SQLLEN indicator = 0;
! 3651                 ret = SQLGetData_ptr(hStmt, i, SQL_C_FLOAT, &realValue, 0, &indicator);
! 3652                 if (SQL_SUCCEEDED(ret) && indicator == SQL_NULL_DATA) {
  3653                     row.append(py::none());
  3654                     break;
! 3655                 }
  3656                 if (SQL_SUCCEEDED(ret)) {
  3657                     row.append(realValue);
  3658                 } else {
  3659                     LOG("SQLGetData: Error retrieving SQL_REAL for column %d - "


📋 Files Needing Attention

📉 Files with overall lowest coverage (click to expand)
mssql_python.pybind.performance_counter.hpp: 0.7%
mssql_python.pybind.logger_bridge.cpp: 57.9%
mssql_python.pybind.ddbc_bindings.h: 64.1%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.ddbc_bindings.cpp: 78.5%
mssql_python.pybind.connection.connection_pool.cpp: 82.3%
mssql_python.pybind.connection.connection.cpp: 82.5%
mssql_python.logging.py: 86.2%
mssql_python.pooling.py: 90.1%
mssql_python.pybind.py_type_cache.hpp: 91.6%

🔗 Quick Links

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

@bewithgaurav Gaurav Sharma (bewithgaurav) changed the title CHORE: Verify profiler report control path TEST: Verify PR Performance Report control path Sep 18, 2026
@bewithgaurav Gaurav Sharma (bewithgaurav) changed the title TEST: Verify PR Performance Report control path CHORE: Verify PR Performance Report control path Sep 18, 2026
@bewithgaurav Gaurav Sharma (bewithgaurav) changed the title CHORE: Verify PR Performance Report control path CHORE: TEST PR Performance Report control path Sep 18, 2026
Copilot AI review requested due to automatic review settings September 18, 2026 10:42

Copilot AI 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.

🟢 Approval recommended

No unresolved issues were identified.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Merge main 2a86fc1 while preserving fetch cache and NULL fixes. Share canonical Row mapping snapshots through Python and native fast constructors, including legacy constructor defaults. Retain main's pooled transaction cleanup changes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace process-static Python attribute names with scoped owning handles outside the row loop. Cover repeated batch construction and reference cleanup when slot assignment fails.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 21, 2026 08:18
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 21, 2026 11:58

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: None

Resolved since last review (1)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 21, 2026 12:22
@github-actions github-actions Bot added pr-size: large Substantial code update and removed pr-size: small Minimal code update labels Sep 21, 2026

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The PR scope does not match its stated canary purpose, and Row changes may break existing public API behavior.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Low severity

Open (1)

Comment thread README.md
@@ -1,4 +1,5 @@
# Microsoft Python Driver for SQL Server
<!-- profiler-report-control-canary: no product code changed -->
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 21, 2026 14:55

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Unresolved API compatibility, fetch-path performance, report coverage, and scope issues remain.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 1 Low severity

Open (2)

Comment thread mssql_python/row.py

# __slots__ eliminates per-instance __dict__ (~232 bytes/row savings),
# and makes attribute access ~30% faster (array index vs dict lookup).
__slots__ = ("_values", "_column_map", "_cursor", "_column_map_lower", "_column_names")
Copilot AI review requested due to automatic review settings September 21, 2026 15:17
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The scope is not README-only, report coverage is incomplete, and the Row changes may break public API compatibility.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)

Comment on lines +436 to +440
f"<kbd>{improvement_tasks} IMPROVEMENT"
f"{'S' if improvement_tasks != 1 else ''}</kbd> "
f"<kbd>{regression_tasks} SLOWDOWN"
f"{'S' if regression_tasks != 1 else ''}</kbd> "
f"<kbd>{len(completed)}/{len(LEGS)} ENVIRONMENTS</kbd>",
Copilot AI review requested due to automatic review settings September 21, 2026 15:22
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI 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.

Copilot review overview

🔵 Needs a closer look

Address the public Row API break, native reference leak, and mismatches between the stated canary scope and CI coverage.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)

Copilot AI review requested due to automatic review settings September 21, 2026 15:28

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Critical CI coverage changes and unresolved fetch-performance and Row compatibility regressions must be addressed.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity · 1 Medium severity · 1 Low severity

Open (4)

jobs:
- job: CodeQLAnalysis
displayName: 'CodeQL Security Analysis'
condition: false
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 21, 2026 18:38

Copilot AI 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.

Copilot review overview

🔵 Needs a closer look

Broad CI coverage is disabled, and the implementation scope conflicts with the README-only canary description.

Review effort: Lite
Findings: 2 High severity · 1 Medium severity · 1 Low severity

Open (4)

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.

4 participants