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

Commits on Dec 3, 2023

  1. 1. add thread pool benchmark test

    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]
    LanderlYoung committed Dec 3, 2023
    Configuration menu
    Copy the full SHA
    5f37f00 View commit details
    Browse the repository at this point in the history
  2. optimize for lua engine

    LanderlYoung committed Dec 3, 2023
    Configuration menu
    Copy the full SHA
    5c78c43 View commit details
    Browse the repository at this point in the history
  3. // fix bug where awaitTermination won't return even if all worker quit.

        // 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
    LanderlYoung committed Dec 3, 2023
    Configuration menu
    Copy the full SHA
    956b54f View commit details
    Browse the repository at this point in the history