Hacker News new | ask | show | jobs
by burntsushi 2925 days ago
> Having said all that, will an implementation of your code with generics be all that much faster?

Likely yes. If generics are implemented via monomorphization, then you can avoid the overhead of virtual calls necessitated by interfaces.

It is possible that the compiler could become smart enough to devirtualize calls through interfaces.

1 comments

Pretty sure devirtualization is a whole program optimization in the general case, and I don’t see the Go dev team Pershing that in the next couple of years.
> I don’t see the Go dev team Pershing that in the next couple of years

Agreed. But if I didn't mention it, I'm sure someone would have felt obligated to respond with a "well actually..."