(This article was originally published at
Blog - Alex (Oleksandr) Polozov. See
On performance in .NET for more comments and better formatting.)
Formerly, when someone asked me “How to make my C# program faster?”, my go-to advice was:
- Improve your computational complexity.
- Switch to a native language.
Of these suggestions, step #1 should take care
(
Read more... )
Comments 3
Good post but I think this point should be right at the top before everything. If it's too slow put it through a profiler. A PhD student of my acquaintance had spent months (literally) working on different database access techniques that would theoretically bring his simulation of a 3D gaming environment down from O(n^2) to O(n log n) which seems like a big win. At my insistence after weeks of nagging he put it through a profiler. > 80% of his code time was executing the sqrt function. No joke -- it was all about working out distances between things and he was using the Euclidean metric via pythogoras as you do. (The sqrt was, in fact, unnecessary as he only wanted to know which was bigger).
Reply
Reply
Reply
Leave a comment