Performance is a key thing in everything; we (humans) don’t like to wait and waste our time. Therefore, sometimes quick solutions, as most of the managers suppose, are better than slow ones but with good engineering and design. But today, we are not speaking about management but about code performance. We have a small text formatting library that allows us to format text using a template in a convenient on our view way. These not only formatting functions do what fmt.Sprintf does this in a more convenient way but also provides additional features. Previous versions of our module were loose in performance to fmt.Sprintf, but since 1.0.1, we are better. And today, we are going to tell you how to make any golang code work faster.
There are two options to pass either argument and/or get function result – by pointer and by value; consider the following example: