Repository navigation
Use bulk copying in GrowableArray.RemoveRange - #2489
Merged
Brian Robbins (brianrob) merged 2 commits intoOct 23, 2026
Merged
Brian Robbins (brianrob) merged 2 commits into
Brian Robbins (brianrob) merged 2 commits into
Conversation
Replace scalar tail shifting with overlap-safe Array.Copy and preserve existing range validation, storage, and truncation behavior. Add value/reference overlap, allocation, exception, and Release truncation regressions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
Note that the "before" measured times are based on other improvements, primarily #2485. There is one other change in the baseline that I haven't pushed yet related to several gigs of unnecessary string allocations (about 2% or so of wall time). I want to be a bit more thorough about the pattern there. This one is pretty straight forward and has potentially broader impact, so I pushed it ahead. |
Brian Robbins (brianrob)
left a comment
Member
There was a problem hiding this comment.
Looks great. One small request below.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Brian Robbins (brianrob)
approved these changes
Oct 23, 2026
Brian Robbins (brianrob)
left a comment
Member
There was a problem hiding this comment.
LGTM. Thanks!
This was referenced Nov 21, 2026
This was referenced Nov 21, 2026
Open
Open
Merged
This was referenced Nov 25, 2026
chore: Bump Microsoft.Diagnostics.Tracing.TraceEvent from 3.1.16 to 4.0.2
atak946/NotchHub-Windows#2
Closed
Open
Nick Moger (nubbymong)
added a commit
to nubbymong/poolwatch
that referenced
this pull request
Nov 27, 2026
Updated [Microsoft.Diagnostics.Tracing.TraceEvent](https://github.com/Microsoft/perfview) from 4.0.0 to 4.0.2. <details> <summary>Release notes</summary> _Sourced from [Microsoft.Diagnostics.Tracing.TraceEvent's releases](https://github.com/Microsoft/perfview/releases)._ ## 4.0.2 ## What's Changed * Fix Capitalize in GetManifestForRegisteredProvider event names by @jdu2600 in microsoft/perfview#2481 * Update .NET SDK To 10.0.402 by @brianrob in microsoft/perfview#2494 * Fix `GetManifestForRegisteredProvider` returning wrong event details for `EventlogClassic` events. by @jdu2600 in microsoft/perfview#2482 * Label GetManifestForRegisteredProvider's string table with CurrentUICulture by @jdu2600 in microsoft/perfview#2488 * Reduce ETLX conversion memory with compact stack indexes by @JeremyKuhne in microsoft/perfview#2485 * Use bulk copying in GrowableArray.RemoveRange by @JeremyKuhne in microsoft/perfview#2489 * Select Processes Before Building ETL And EventPipe Stack Sources by @brianrob in microsoft/perfview#2496 * Fix Unsigned Integer Decoding In TDH Payloads by @brianrob in microsoft/perfview#2495 * Honor StopProcessing in EventPipeEventSource by @pcshrosbree in microsoft/perfview#2497 * Validate Scenario Export Output File Names by @brianrob in microsoft/perfview#2504 * Skip Predefined Template Lookups For Unrelated EventPipe Providers by @brianrob in microsoft/perfview#2503 * Avoid Allocating Predefined Dynamic Parser Lookup Keys by @brianrob in microsoft/perfview#2502 * Increase File-Backed Serialization Buffer To Reduce ETLX Write Overhead by @brianrob in microsoft/perfview#2505 * Fix Hidden PDB Trust Dialog After Switching Applications by @brianrob in microsoft/perfview#2507 * Fix reserved keyword threshold in GetManifestForRegisteredProvider by @jdu2600 in microsoft/perfview#2509 * Validate Event Payload Fields, Strings, Arrays, And Related-Activity GUIDs * Validate BPerf Session Headers, Compressed Blocks, And Decompression Bounds * Require Complete CTF Reads And Validate Array Sizes And Payload Lengths * Bound Captured Packet Headers And TCP Options While Preserving Non-IP And Fragment Handling * Validate PE Cache Ranges And Require Complete Pointer Reads * Decode Kernel TCP Connection IDs And Sequence Numbers According To Event Version ## New Contributors * @jdu2600 made their first contribution in microsoft/perfview#2481 * @pcshrosbree made their first contribution in microsoft/perfview#2497 **Full Changelog**: microsoft/perfview@v4.0.0...v4.0.2 Commits viewable in [compare view](microsoft/perfview@v4.0.0...v4.0.2). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: nubbymong <192402368+nubbymong@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 27, 2026
Open
Closed
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace element-by-element shifting in
GrowableArray<T>.RemoveRangewith overlap-safeArray.Copy. This lets the runtime move the surviving tail efficiently without allocating or replacing the backing array.Preserve element order, reference identity, trailing backing-array contents, zero-count behavior, oversized-range truncation, and existing exception types. Validate overflow before addition and make the debug assertion overflow-safe.
Performance
Full native CPU profiling of a 79.81-GB ETL conversion identified range removal during method/address resolution as 17.45% of process CPU samples. Matched conversions measured:
Each pair used the same trace input, runtime, and converter implementation, differing only in whether range removal used the scalar loop or bulk copying. The pilots measured the initial bulk-copy implementation before the subsequent behavior-preserving validation/readability cleanup. No profiler was attached to either timed arm.
Managed allocations were unchanged. Complete unchanged-reader fingerprints matched all retained events and payloads, event-to-stack associations, stack nodes/roots, code-address/method/tier/IL mappings, and accounting, with no loss or truncation.
Other callers removing ranges with large surviving tails should also benefit. Appending, indexing, clearing, and removing from the end are unaffected. The operation remains linear in the number of elements moved.
These are single paired pilots, not guaranteed speedups. Peak commit decreased 3.92% on the large input and increased 2.26% on the smaller input; no structural retention improvement is claimed.
Tests
Regression coverage includes exhaustive valid ranges, overlapping value/reference moves, unchanged backing storage, zero managed allocation for a large move on .NET, overflow exceptions, and Release-only oversized-range truncation.
Validation on this standalone branch based on current upstream
main:dotnet test src\FastSerialization.Tests\FastSerialization.Tests.csproj -c Debug --logger trx -v quiet- passed: 117 tests on each of .NET 10 and .NET Framework 4.6.2.dotnet test src\FastSerialization.Tests\FastSerialization.Tests.csproj -c Release --logger trx -v quiet- passed: 118 tests on each runtime.dotnet test src\TraceEvent\TraceEvent.Tests\TraceEvent.Tests.csproj -c Debug --framework net10.0 --logger "trx;LogFileName=traceevent-current-main-Debug.trx" -v quiet- passed: 2,799 tests, 4 skipped.All test commands also used
--results-directoryto retain local TRX reports. The full native/WPF solution build was not run; the required Visual Studio components are not installed locally.