On Fri, 13 Nov 2015 at 23:03 Vasiliy Tolstov wrote:
2015-11-13 13:29 GMT+03:00 Giulio Iotti <email@example.com
Then it's really a micro-optimization.
Yes, but in why not do it if this is simple =)
I know you put a smiley, but it's a good question and deserves a serious
Optimization can reduce readability
> and add code that is used only
to improve the performance
>. This may complicate
programs or systems, making them harder to maintain and debug. As a result,
optimization or performance tuning is often performed at the end of
Donald Knuth <https://en.wikipedia.org/wiki/Donald_Knuth
> made the
following two statements on optimization:
"We should forget about small efficiencies, say about 97% of the time:
premature optimization is the root of all evil. Yet we should not pass up
our opportunities in that critical 3%"
The reason not to do it is because it makes the code harder to read and
understand for what you agree is almost no benefit. The cost will come to
the person (maybe you!) trying to understand this code a year from now. The
cost will be to the person cutting and pasting this code into a new context
in which the optimization doesn't apply because the file type is not known
For program optimizations, you should have a concrete measurable reason
"why" and not just "why not?" The simple rule is: if you're asking if you
should optimize the answer is "no." When it's time to optimise you will
*know* - you'll know why, and you'll know where - because you've measured.
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/d/optout.