Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce allocations for CreateDirectory #61777

Merged
merged 7 commits into from
Nov 19, 2021
Merged

Conversation

adamsitnik
Copy link
Member

@adamsitnik adamsitnik commented Nov 18, 2021

I wanted to see what would it take to have a sys-call that accepts a ROS<char> instead of string and after that I've discovered the existence of ValueListBuilder<int> which allowed me to get rid of List<int> allocation.

BenchmarkDotNet=v0.13.1.1616-nightly, OS=ubuntu 18.04
Intel Xeon CPU E5-1650 v4 3.60GHz, 1 CPU, 12 logical and 6 physical cores
.NET SDK=7.0.100-alpha.1.21566.20
Method Toolchain depth Mean Ratio Allocated
RecursiveCreateDeleteDirectory /before/corerun 10 314.9 us 1.00 8 KB
RecursiveCreateDeleteDirectory /after/corerun 10 296.1 us 0.95 7 KB
RecursiveCreateDeleteDirectory /before/corerun 100 3,565.2 us 1.00 140 KB
RecursiveCreateDeleteDirectory /after/corerun 100 3,559.1 us 1.00 113 KB

@adamsitnik adamsitnik added area-System.IO tenet-performance Performance related issue labels Nov 18, 2021
@adamsitnik adamsitnik added this to the 7.0.0 milestone Nov 18, 2021
@adamsitnik adamsitnik requested a review from tmds November 18, 2021 14:52
@ghost
Copy link

ghost commented Nov 18, 2021

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Issue Details

I wanted to see what would it take to have a sys-call that accepts a ROS<char> instead of string and after that I've discovered the existence of ValueListBuilder<int> which allowed me to get rid of List<int> allocation.

Author: adamsitnik
Assignees: -
Labels:

area-System.IO, tenet-performance

Milestone: 7.0.0

@adamsitnik adamsitnik added the os-linux Linux OS (any supported distro) label Nov 18, 2021
Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than passing the VLB by ref (which needs to be done), LGTM.

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Copy link
Member

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @tmds has a PR open that's touching directory deletion APIs.

Maybe the deletion APIs could benefit from a similar allocation reduction?

#59520

Copy link
Member

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I meant to approve it, not comment.

LGTM (pending hearing from @AaronRobinsonMSFT in Stephen's question).

@adamsitnik adamsitnik requested a review from tmds November 19, 2021 07:54
@tmds
Copy link
Member

tmds commented Nov 19, 2021

I learned a few new tricks from this PR. Thanks @adamsitnik!

@adamsitnik adamsitnik merged commit ba4eae0 into dotnet:main Nov 19, 2021
@adamsitnik adamsitnik deleted the removeAllocs branch November 19, 2021 12:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.IO os-linux Linux OS (any supported distro) tenet-performance Performance related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants