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

* Registry.GetSubKeyNames : Remove List copy to Array #79345

Merged
merged 2 commits into from Jan 2, 2023

Conversation

Poppyto
Copy link
Contributor

@Poppyto Poppyto commented Dec 7, 2022

Very similar to PR #78737 but with Values
Avoid copying List => ToArray() and handle rare cases with new entries during the loop by multiplying memory by 2 (like List does)

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Dec 7, 2022
@ghost
Copy link

ghost commented Dec 7, 2022

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

Issue Details

Very similar to PR #78737 but with Values
Avoid copying List => ToArray() and handle rare cases with new entries during the loops by multiplying memory by 2 (like List does)

Author: Poppyto
Assignees: -
Labels:

area-Microsoft.Win32, community-contribution

Milestone: -

@Poppyto Poppyto changed the title * Remove List copy to Array * Registry.GetSubKeyNames : Remove List copy to Array Dec 7, 2022
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thanks!

@jkotas jkotas merged commit a08cfcb into dotnet:main Jan 2, 2023
@MartyIX
Copy link
Contributor

MartyIX commented Jan 2, 2023

Could anyone explain please why this is worth optimizing?

I don't question anything I'm just interested if this is a frequently used operation or what the motivation is.

@danmoseley
Copy link
Member

danmoseley commented Jan 2, 2023

Generally we will take changes that optimize an API for throughput and/or allocations if they do do without significant increases in complexity or maintenance burden. This is because as a platform we don't know what will be in the hot path of an app that uses us, and small improvements in this platform may contribute to thousands of apps, or very high scale services, for many years.

If we do know an API is commonly on the hot path we often will do this ourselves and also accept more complexity (just look at IndexOf).

I imagine that something like libc operates in a similar way.

@dotnet dotnet locked as resolved and limited conversation to collaborators Feb 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Microsoft.Win32 community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants