How slow is using type assertions / type switches in Go, as a method of run-time type discovery?
I\'ve heard that in C/C++ for example, discovering types at run time
In your
switch v := anything.(type) {
case SomeCustomType:
fmt.Println(v)
...
if you need not SomeCustomType.Fields or methods like in fmt.Println(v), doing
switch anything.(type) { //avoid 'v:= ' interface conversion, only assertion
case SomeCustomType:
fmt.Println("anything type is SomeCustomType", anything)
...
should be approximately two times faster