Repository navigation
TryAddWithoutValidation for multiple values could be more efficient #64049
Copy link
Copy link
Closed
Labels
area-System.Net.HttpenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedtenet-performancePerformance related issuePerformance related issue
Milestone
Description
Activity
- addedtenet-performancePerformance related issuePerformance related issue
on Jan 20, 2022 - ghost addeduntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Jan 20, 2022 - addedenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsand removeduntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Jan 27, 2022 Triage: Worth investment, but the method is not commonly used, so not priority.
I am confident that this will grant a performance advantage. As @karelz mentioned, this does not seem to be a method on the hot path.
@MihaZupan
Do you feel like submitting a pull request and also creating a benchmark in dotnet/performance?It's not a priority for us for now, but I'll happily review a PR if you are interested :)
- addedhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
on Jan 2, 2023 - addedin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
on May 29, 2024 - locked and limited conversation to collaborators
on Jul 25, 2024
Metadata
Metadata
Assignees
Labels
area-System.Net.HttpenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedtenet-performancePerformance related issuePerformance related issue
The method takes an
IEnumerable<string>. Things we could improve:IList<string>or some other type to avoid boxing the enumeratorListresizes if we already know the final sizeFor example
Will currently allocate the enumerator, a
List<string>of size 2, and aList<string>of size 4.We can reduce that down to allocating a single
List<string>of size 3.An example of how this can be achieved:
https://gist.github.com/MihaZupan/800df7a324a66a8e814c3ec91f3d39b0