Skip to content

It will be useful to have algorithmic complexity of standard operations provided by the .NET library #5179

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

Open
gewarren opened this issue Dec 16, 2020 · 8 comments
Labels
area-System.Collections Pri3 Indicates issues/PRs that are low priority
Milestone

Comments

@gewarren
Copy link
Contributor


Issue moved from MicrosoftDocs/feedback#3306


From @katoch on Wednesday, December 2, 2020 3:23:26 AM

Is your feature request related to a problem? Please describe.
I'm surprised that most microsoft references for .NET library do not provide complexity information for standard operations. In comparison the C++ standard library documentation has this for all standard library operations.

Describe the solution you'd like
A brief mention of space/time complexity for operations will be useful in determining optimal solutions while writing code in .NET. The references are not complete without this information in my opinion.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@gewarren
Copy link
Contributor Author


Issue moved from MicrosoftDocs/feedback#3306


From @WELCOME[bot] on Wednesday, December 2, 2020 3:23:28 AM

Thank you for creating the issue! One of our team members will get back to you shortly with additional information. If this is a product issue, please close this and contact the particular product's support instead (see https://support.microsoft.com/allproducts for the list of support websites).

@dotnet-bot dotnet-bot added the untriaged New issue has not been triaged by the area owner label Dec 16, 2020
@PRMerger10 PRMerger10 added the Pri3 Indicates issues/PRs that are low priority label Dec 16, 2020
@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@svick
Copy link
Contributor

svick commented Dec 20, 2020

Which operations are you talking about specifically? Because some already provide their time complexity, e.g. the documentation for List<T>.Insert says:

This method is an O(n) operation, where n is Count.

@gewarren
Copy link
Contributor Author

@katoch Please see the question that @svick posed ⬆

@katoch
Copy link

katoch commented Dec 21, 2020 via email

@eiriktsarpalis
Copy link
Member

I think it might be useful to have a separate complexity section which just provides that information.

Does the C++ standard library have a section like that? At quick glance I couldn't find something. I agree we could have included this information in some places (collections jump to mind), but in others it's probably counterproductive.

@eiriktsarpalis eiriktsarpalis added area-System.Collections and removed untriaged New issue has not been triaged by the area owner labels Feb 26, 2021
@eiriktsarpalis eiriktsarpalis added this to the Backlog milestone Feb 26, 2021
@svick
Copy link
Contributor

svick commented Feb 27, 2021

@eiriktsarpalis The documentation at cppreference.com does, for example:

@udlose
Copy link

udlose commented Oct 12, 2024

Which operations are you talking about specifically? Because some already provide their time complexity, e.g. the documentation for List<T>.Insert says:

This method is an O(n) operation, where n is Count.

and it is not clear which complexity metric this is referring to: Time Complexity or Space Complexity (memory usage). One can only assume it is Time Complexity. Which brings up another issue: Space Complexity is missing everywhere. This is extremely important for Data Types and methods/extension methods that are considered "go-to's" for performance tuning nowadays with performance efforts very frequently focused on reduction of memory consumption. The only other way to accomplish this is to write benchmarks using BenchmarkDotNet to try and measure memory consumption. However, this technique is both time-consuming and, more importantly, results depend on how well (comprehensive) the benchmarks are written. Most devs aren't going to spend the time to write comprehensive benchmarks considering that writing these benchmarks is time consuming. Thus, they end up possibly selecting the wrong type or method for their use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Collections Pri3 Indicates issues/PRs that are low priority
Projects
None yet
Development

No branches or pull requests

8 participants