vapor-community / sockets

🔌 Non-blocking TCP socket layer, with event-driven server and client.
MIT License
575 stars 54 forks source link

Making the TCPClient class final #55

Closed tanner0101 closed 8 years ago

tanner0101 commented 8 years ago

Making the TCPClient class final could potentially give some performance benefits since the compiler could use direct method calls.

czechboy0 commented 8 years ago

Does final still allow adding extensions?

tanner0101 commented 8 years ago

It should only prevent subclassing. Extensions seem like they will always be dynamic calls. Probably no way to optimize that.

czechboy0 commented 8 years ago

I'd be fine with doing this, I just want to make sure there's a good reason. Probably the best evidence would be if you tried profiling with and without final and told me the difference in your usecase. It's always a balance. But we would be giving up some flexibility (the ability to subclass TCPClient), so I want to understand how much we'd gain here.

tanner0101 commented 8 years ago

I didn't know you had the intent to allow subclassing on TCP client.

If that is the case, then the end user can make a final subclass themselves if they need the added performance.