Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt: eliminate the fd->connection map when handling I/O events #230

Merged
merged 19 commits into from
Jul 18, 2021

Conversation

panjf2000
Copy link
Owner

@panjf2000 panjf2000 commented Jul 18, 2021

By default, gnet utilizes the standard package golang.org/x/sys/unix to implement pollers with epoll or kqueue, on the other hand, when users run go build with build tags poll_opt, like this: go build -tags=poll_opt, gnet will switch to the optimized implementation by invoking the system calls of epoll or kqueue directly, which eliminates the HASH MAP of fd->conn, it ought to achieve a higher performance with this optimization.

@codecov
Copy link

codecov bot commented Jul 18, 2021

Codecov Report

Merging #230 (5157885) into master (5548133) will decrease coverage by 1.81%.
The diff coverage is 71.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #230      +/-   ##
==========================================
- Coverage   85.08%   83.27%   -1.82%     
==========================================
  Files          18       19       +1     
  Lines        1415     1477      +62     
==========================================
+ Hits         1204     1230      +26     
- Misses        158      188      +30     
- Partials       53       59       +6     
Flag Coverage Δ
unittests 83.27% <71.28%> (-1.82%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
connection_bsd.go 0.00% <0.00%> (ø)
connection_linux.go 0.00% <0.00%> (ø)
acceptor_bsd.go 48.48% <48.48%> (ø)
eventloop_unix.go 72.25% <50.00%> (-1.66%) ⬇️
acceptor_linux.go 48.48% <63.15%> (ø)
server_unix.go 88.67% <83.33%> (ø)
reactor_default_linux.go 83.67% <83.67%> (ø)
reactor_default_bsd.go 92.72% <92.72%> (ø)
connection_unix.go 75.93% <100.00%> (+0.36%) ⬆️
gnet.go 73.17% <100.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5548133...5157885. Read the comment docs.

@panjf2000 panjf2000 merged commit 551cd5b into master Jul 18, 2021
0-haha pushed a commit to 0-haha/gnet that referenced this pull request Jan 25, 2023
…2000#230)

By default, `gnet` utilizes the standard package `golang.org/x/sys/unix` to implement pollers with `epoll` or `kqueue`, on the other hand, when users run `go build` with build tags `poll_opt`, like this: `go build -tags=poll_opt`, `gnet` will switch to the optimized implementation by invoking the system calls of `epoll` or `kqueue` directly, which eliminates the HASH MAP of `fd->conn`, it ought to achieve a higher performance with this optimization.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant