Commit 82de73a
perf: pre-compute quoted column names for DataTable.Update RowUpdating handler
The RowUpdating event fires once per INSERT row during DataTable.Update().
Previously the handler iterated all columns, called commandBuilder.QuoteIdentifier
for every refreshable column, and allocated a ResizeArray on every row.
Column metadata (AutoIncrement/AllowDBNull flags) and quoted column names are
constant for the lifetime of a single Update() call, so we pre-compute them
once before subscribing:
- alwaysRefreshQuoted: quoted names for AutoIncrement columns (server always
supplies the value)
- maybeRefreshCols: (DataColumn, quotedName) pairs for AllowDBNull columns;
only added per-row when the row has no explicit value
This eliminates O(columns) QuoteIdentifier calls and a full column-iteration
per INSERT row, replacing them with a single pre-computation and a cheaper
per-row scan over the smaller maybeRefreshCols array.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 3a9a563 commit 82de73a
1 file changed
+19
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
60 | 73 | | |
61 | 74 | | |
62 | 75 | | |
63 | 76 | | |
64 | 77 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
72 | 83 | | |
73 | 84 | | |
74 | 85 | | |
| |||
0 commit comments