owenthereal/thunderbird

Speedup the event fanout

utrack opened this issue · 3 comments

Hey, nice project!
My two cents, maybe it's better to store map[chanName]<connID | Connection> ?
It would help if there's tons of connections; Current implementation iterates over all the connections, which could be very inefficient.

I guess @utrack is talking about this loop which does seem inefficient. Each connection stores its own list of subscribed channels. IMO the association of connections <=> channels should be at the Thunderbird struct level and this would allow for a more efficient collection of all connections subscribed to a particular channel.

@Roman2K Yep, precisely.

@utrack @Roman2K Thanks for the feedback and good point! Unfortunately this repo is frozen for judging for Gopher Gala. I will fix this in my fork. Eventually the repo will be migrated to my account after the judging is done.

A shameless plug: if you like what you see, please vote for this project ("thunderbird") in https://obscure-savannah-52814.herokuapp.com 🍻.