Ennixo <en****@free.fr > wrote:
do you know where i can find some ebooks or websites talking about C#
optimisation ?
for exemple, i just learned that ++i is faster than i++.
In C#? I don't think so. It *can* be faster in *some* languages, but
it's rarely going to make a significant difference.
i would like to
know more about the things that can make code faster than fast.
Proper design and profiling when necessary, basically. Micro-
optimisations rarely make a significant difference to overall
performance - even if tweaking your code makes one section of code five
times faster, unless a significant amount of time is spent in that part
of the code, it's not going to make much difference. Obviously it
depends on the app, but in many apps these days the most significant
performance bottlenecks come from things like network/database access,
bad choice of threading, etc.
Furthermore, micro-optimisations tend to come at the expense of the
code being as readable as it can be, which IMO should be the primary
goal.
If your app isn't performing well enough, get a profiler and find out
exactly where the bottleneck is. At that point, and only at that point,
should you be really worried about micro-optimisations.
--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too