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

add thread pool benchmark test AND optimize MessageQueue::findInsertPositionLocked #102

Merged
merged 3 commits into from Dec 3, 2023

Conversation

LanderlYoung
Copy link
Collaborator

No description provided.

2. optimize  MessageQueue::findInsertPositionLocked

on M2Pro release build

before
1-producers 1-workers time:1001ms,    839050 ops [   838211 ops/S] [  1193.02 ns/op]
1-producers 2-workers time:1000ms,   2779911 ops [  2779911 ops/S] [  359.724 ns/op]
1-producers 4-workers time:1000ms,   1114618 ops [  1114618 ops/S] [  897.168 ns/op]
2-producers 1-workers time:1001ms,    589169 ops [   588580 ops/S] [     1699 ns/op]
4-producers 1-workers time:1002ms,    424131 ops [   423284 ops/S] [  2362.48 ns/op]
2-producers 2-workers time:1000ms,   2995803 ops [  2995803 ops/S] [    333.8 ns/op]
4-producers 4-workers time:1000ms,   1292282 ops [  1292282 ops/S] [  773.825 ns/op]

after
1-producers 1-workers time:1000ms,   4298036 ops [  4298036 ops/s] [  232.664 ns/op]
1-producers 2-workers time:1000ms,   3203516 ops [  3203516 ops/S] [  312.157 ns/op]
1-producers 4-workers time:1000ms,   1712284 ops [  1712284 ops/S] [  584.015 ns/op]
2-producers 1-workers time:1000ms,   3951540 ops [  3951540 ops/S] [  253.066 ns/op]
4-producers 1-workers time:1000ms,   1818734 ops [  1818734 ops/S] [  549.833 ns/op]
2-producers 2-workers time:1000ms,   4836283 ops [  4836283 ops/S] [   206.77 ns/op]
4-producers 4-workers time:1000ms,   2185713 ops [  2185713 ops/S] [  457.517 ns/op]
    // https://en.cppreference.com/w/cpp/thread/condition_variable
    // follow what the STD told us to
    // "Even if the shared variable is atomic, it must be modified while owning the mutex to
    // correctly publish the modification to the waiting thread."
    // DEEP EXPLAINATION:
    // https://stackoverflow.com/questions/38147825/shared-atomic-variable-is-not-properly-published-if-it-is-not-modified-under-mut
Copy link
Collaborator Author

@LanderlYoung LanderlYoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LanderlYoung LanderlYoung merged commit 916b37d into main Dec 3, 2023
41 checks passed
@LanderlYoung LanderlYoung deleted the feature/threadpool_concurrency branch December 3, 2023 16:34
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.

None yet

1 participant