Using memoization for performance

When doing heavy computations one thing that can be done for increasing performance is not
to repeat any calculation that has already been done and that must be reused. Instead cache the
calculated value in memory, which is called memoization. A great example of this is the Fibonacci


Defer and tracing

The defer keyword allows us to postpone the execution of a statement or a function until the end
of the enclosing (calling) function:
it executes something (a function or an expression) when the enclosing function returns
(after every return and even when an error occurred in the midst of
executing the function, not only a return at the end of the function), but before the } (Why after?
Because the return statement itself can be an expression which does something instead of only
giving back 1 or more variables).


Arrays ans Slice in Golang

Arrays are one of the most popular data structures for two reasons: arrays are simple and
easy to understand and they are very versatile and can store many different kinds of data.
You can declare an array that stores four integers as follows:


Subscribe to RSS - Golang