3 ms·
That’s a cool background. Can you share more about your product? I’m also struggling to see the great benefit of generics apart from “it’s quicker than using i
by holografix 5y ago
That’s a cool background. Can you share more about your product?
I’m also struggling to see the great benefit of generics apart from “it’s quicker than using interface types, trust us”.
I didn’t know a ring buffer was a “formal” data structure thingy but implemented one for a toy multiplayer game I’m building very slowly. There’s a “circular list” of the 5 last received messages from the server and if the position as indicated by the server deviated above a certain threshold I warp the player back to where they should be according to the server.
I knew these message objects were gonna be allocated/nuked constantly so I just have 5 one pointing to the other and the last pointing back to the first and I go around overwriting them.
- styluss 5y ago> "it’s quicker than using interface types, trust us During runtime, the program doesn't know the actual type of the variable, it just knows it's a io.Reader and dereferences to the actual type vs generating the code for the type that is actually being used. Here's an interesting read on issues with interfaces at scale https://segment.com/blog/allocation-efficiency-in-high-performance-go-services/ https://segment.com/blog/allocation-efficiency-in-high-perfo...