gnet utilizes the standard package
golang.org/x/sys/unix to implement pollers with
kqueue, where a HASH MAP of
fd->conn is introduced to help retrieve connections by file descriptors returned from pollers, but now the user can run
go build with build tags
poll_opt, like this:
go build -tags=poll_opt, and
gnet then switch to the optimized implementations of pollers that invoke the system calls of
kqueue directly and add file descriptors to the interest list along with storing the corresponding connection pointers into
kevent, in which case
gnet can get rid of the HASH MAP of
fd->conn and regain each connection pointer by the conversion of
void* pointer in the I/O event-looping. In theory, it ought to achieve a higher performance with this optimization.
See #230 for code details.
Get This Change
This change was made available in 1.5.2.