Avoid unnecessary allocations in single-file app bundle launch - #132435
Merged
Conversation
file_entry_t::relative_path() returned by value, so every manifest comparison copied a std::string. Return a reference instead. Files used directly from the bundle are resolved by the runtime through the bundle probe and have no path on disk, so stop building one for them when resolving the app's dependencies. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces transient native allocations during single-file app startup by avoiding construction of unused on-disk paths for bundle-contained (non-extracted) assets, and by tightening related probing/control flow in hostpolicy.
Changes:
- Avoid building/reserving full file-system paths when a deps asset is satisfied directly from the single-file bundle (no extraction).
- Simplify probe result handling for “found in bundle” cases to avoid unnecessary path usage/logging.
- Reduce copying in bundle manifest accessors (return
relative_path()by reference).
Show a summary per file
| File | Description |
|---|---|
| src/native/corehost/hostpolicy/deps_resolver.cpp | Returns bundled earlier to avoid using an empty candidate path and to streamline probing flow. |
| src/native/corehost/hostpolicy/deps_entry.cpp | Defers candidate.reserve()/path construction until after bundle probing; updates tracing for extracted vs non-extracted bundle assets. |
| src/native/corehost/bundle/runner.h | Updates locate() documentation (and should further clarify semantics when not extracted). |
| src/native/corehost/bundle/runner.cpp | Avoids constructing a “fake” on-disk path for non-extracted bundle entries. |
| src/native/corehost/bundle/file_entry.h | Returns relative_path() by const reference to avoid copies. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Lite
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Review details
Suppressed comments (1)
src/native/corehost/bundle/runner.h:40
- runner_t::locate(const pal::string_t&, pal::string_t&) calls a 3-parameter locate overload which is not declared in runner.h (only defined in runner.cpp). This will not compile, and the preceding comment refers to an extracted_to_disk out-parameter that doesn’t exist on this overload.
bool locate(const pal::string_t& relative_path, pal::string_t& full_path) const
{
bool extracted_to_disk;
return locate(relative_path, full_path, extracted_to_disk);
}
- Files reviewed: 5/5 changed files
- Comments generated: 0 new
- Review effort level: Lite
This was referenced Aug 18, 2026
AaronRobinsonMSFT
approved these changes
Aug 19, 2026
Member
Author
|
/ba-g build analysis misclassifying known test failures - dotnet/arcade#17340 |
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.
Remove a bunch of unnecessary transient allocations during single-file launch. The amount scales with the number of bundled assets.
For single-file, self-contained, empty console app, Windows x64:
Startup was using the dotnet/performance repo's
TimeToMainscenario - average over 10 runs of 20 launches per run, with every run showing an improvement between 1.3-4.8%. Native heap allocation count and bytes were measured with xperf heap tracing.cc @dotnet/appmodel @AaronRobinsonMSFT