-
Notifications
You must be signed in to change notification settings - Fork 826
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
Atomic single linked list (pj_atomic_slist) #4330
Open
LeonidGoltsblat
wants to merge
42
commits into
pjsip:master
Choose a base branch
from
LeonidGoltsblat:pj_atomic_slist
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+1,026
−6
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- some changes in sln to build with v143 build tools (VS 2022) - 2 new pjsystest project configuration to build as Debug-Dynamic and Release-Dynamic - stack implementation and testing incorporated into pjlib and pjlib-test projects
decreased the repeat counter increased the number of threads
# Conflicts: # pjlib/build/pjlib.vcxproj.filters
# Conflicts: # pjlib/build/Makefile # pjlib/build/pjlib_test.vcxproj.filters # pjlib/src/pjlib-test/test.c
sauwming
approved these changes
Mar 3, 2025
bug fixed in generic implementation of pj_atomic_slist_size() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the second reincarnation of the #4116.
With the introduction of alignment-aware memory allocation, things have become much simpler and no longer require global changes to the library.
Implemented in 2 versions:
PJ_ATOMIC_SLIST_WIN32 using Windows's single linked list and
PJ_ATOMIC_SLIST_GENERIC - os independent "cross-platform" implementation.
Project build system automatically compliles the first for Windows platform and the second for others.
Performance comparison.
Tested under Windows 10, AMD Ryzen 3 2200U with Radeon Vega Mobile Gfx 2.50 GHz, 4 cores.
Single-threaded test - performance without contention, 100,000 push/pop pairs.
Multi-threaded test - performance with maximum possible contention, 4 threads, 100,000 push/pop pairs each.
3 passes for each implementation variant (see atomic_slist_mt_test()).
PJ_ATOMIC_SLIST_WIN32
02:13:30.282 ...slist (single thread) time: 14 ms (total), 141 nanosec/op
02:14:37.407 ...slist (single thread) time: 17 ms (total), 171 nanosec/op
02:15:34.514 ...slist (single thread) time: 16 ms (total), 168 nanosec/op
02:13:30.352 ...slist (multi threads) time: 57 ms (total), 144 nanosec/op
02:14:37.476 ...slist (multi threads) time: 51 ms (total), 129 nanosec/op
02:15:34.570 ...slist (multi threads) time: 47 ms (total), 118 nanosec/op
PJ_ATOMIC_SLIST_GENERIC
02:20:58.810 ...slist (single thread) time: 18 ms (total), 183 nanosec/op
02:22:35.733 ...slist (single thread) time: 18 ms (total), 189 nanosec/op
02:23:55.236 ...slist (single thread) time: 14 ms (total), 143 nanosec/op
02:20:58.971 ...slist (multi threads) time: 151 ms (total), 378 nanosec/op
02:22:35.921 ...slist (multi threads) time: 174 ms (total), 436 nanosec/op
02:23:55.425 ...slist (multi threads) time: 177 ms (total), 444 nanosec/op
single thread: slists is a little faster
multi threads: slists does not show performance degradation with contention (this is the main measurement result) and works more than 3 times faster, each operation is faster by more than 250-300 nanoseconds