Finding runtime details for C# builtins
As a follow up question to this one I asked yesterday, are there any good resources for finding the expected, worst case, or best case runtimes of the various开发者_JAVA百科 c# builtin methods?
Again, I am not looking for a search engine. When developing software, an API is useful, but it seems that that API should also include a runtime promise.
When I need to get an idea of what is going on, I often use Reflector. Even though it does not provide any timings as such, reading the code will give you an idea of its performance.
When you say runtimes, do you mean execution time? Based on your previous question, are you want to know things like a call to GetType() for example? If so, that would be difficult since the execution time of a function is dependent many things, least of which would be the hardware that it is running on and of course to the data passed to the function.
Of course for algorithms there is big-O notation (complexity) of the algorithm. Which can be used as a guideline to selecting the most appropriate algorithm for a specific problem. For example adding an item to a linked list is an O(1) operation, where searcing a linked list for an item is an O(n) operation where n relates to the number of items in the linked list, but a hash table lookup is again an O(1) operation etc. etc.
精彩评论