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
feat: use ConcurrentMap to replace map and mutex #187
base: master
Are you sure you want to change the base?
Conversation
how is this compared with sync.Map? |
Codecov Report
@@ Coverage Diff @@
## master #187 +/- ##
==========================================
- Coverage 81.89% 80.51% -1.39%
==========================================
Files 11 11
Lines 2055 1863 -192
==========================================
- Hits 1683 1500 -183
+ Misses 288 280 -8
+ Partials 84 83 -1
Continue to review full report at Codecov.
|
if there's only one link, the benefit from your algorithm is only the xxhash algorithm right? the locking part is still the RLock? How about caching + sync.Map? |
Change-Id: I923ef54bcd475a460af6eadc681aeeff5592f335
5f2ef41
to
0b6888f
Compare
segment lock also helps a lot |
benchmark is
|
For random r/w, segment lock is efficient surely. But in kcp-go, for most of the time, just read lock is required to retrieve the session object. Write lock only happens twice(1. connection establishment, 2. connection termination) |
Compared to map + sync.Mutex, ConcurrentMap is proved reliable and more efficient