resharper - Do redundant expressions, directives and qualifiers impact performance? -
i'm working else's code right , resharper giving me lot of warnings redundant code, such as:
- unused directives
- array creation expressions (
new string[]{xxx,xxx,xxx}
instead of{xxx,xxx,xxx}
) - explicit delegate creation (
new eventhandler(xxx)
instead ofxxx
) - qualifiers (
system.windows.forms.form
instead ofform
when directives used)
there lot of code work with, i'm not sure if it's worth going through , removing redundant code.
with in mind, wanted ask if these warnings there improve code style (for aesthetics) or pieces of code perform operations , impact performance little?
it depends.
abbreviated array initializers i'm pretty sure compile same cil
explicit delegate creation i'm not sure, i'd expect same performance
unneeded qualifiers i'm sure compile same cil.
however
the computer's time in general much less important your time, or time of else reading code. take piece of code , replace int
s system.int32
s , take longer read , longer understand, , important 'performance' metrics.
programs must written people read, , incidentally machines execute, cleverer person me once wrote.
Comments
Post a Comment