tmds / Tmds.LinuxAsync

MIT License
25 stars 3 forks source link

Refactor socket operations into classes #66

Closed tmds closed 4 years ago

tmds commented 4 years ago

This is a refactoring.

It introduces separate classes for different socket operations instead of switch(SocketAsyncOperation) in AsyncSocketOperation.

I had used the switch(SocketAsyncOperation) to reduce LOC to do the implementation.

Having separate classes is more similar to corefx implementation.

It should allow some optimizations, like splitting up TryExecute. Or make it possible to use these classes directly as Operation instances in the AsyncExecutionQueue. Such optmizations are expected to bring only minor gains based on the tracing.

cc @adamsitnik @antonfirsov

tmds commented 4 years ago

@antonfirsov when you benchmark the io_uring without linked operations. Maybe you can run additional benchmark including these changes, and verify there is no regression?

antonfirsov commented 4 years ago
"-e=epoll" --arg  "-t=6" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
RPS CPU (%) Avg. Latency (ms)
socket_op_classes 452,555 100 1.08
master 452,817 99 1.12

So we are ok :)

tmds commented 4 years ago

Anton, thank you for verifying there is no performance regression!