go – Performance impact of type conversion from empty interface (dynamic) to static type in golang-ThrowExceptions

Exception or error:

Does converting an empty interface to type have any performance impact?

var generic interface{}
generic = 34
i = d.(int)

Does this conversion has any impact on performance?
I am working on in-memory cache using map, my definition of map goes like this

cache map[interface{}]interface{}

The above map is more generic than the below implementation

cache map[string][]byte

I want to know if there will be any performance hit by using generic and converting them back. Any reference documentation will be appreciated.

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *