bad effect on performance (as mentioned here)
===============
Method calls on interface types are a dynamic dispatch — the actual concrete implementation to use is only determinable at runtime. Consider a variable r with an interface type of io.Reader. A call to r.Read(b) will cause both the value of r and the backing array of the byte slice b to escape and therefore be allocated on the heap.
===============
So what we can do? Without using the interface, we can't even test our code as well and our design get overcomplicated.
Just don't use interfaces for everything, use them only when they are necessary.
so what is your problem? If you’re worried about performance - have you proven performance to be a problem?
that's true, but sometimes is more important understand the code, interfaces make it easy
lol if you're that concerned about performance go learn assembly
you can use generators, and the unicode symbols "<" and ">" which is called Aboriginal ... symbol
Обсуждают сегодня