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

Brainstorming: Rethink Threadpool and Workers #61

Open
jeschkies opened this issue Sep 30, 2016 · 1 comment
Open

Brainstorming: Rethink Threadpool and Workers #61

jeschkies opened this issue Sep 30, 2016 · 1 comment
Assignees

Comments

@jeschkies
Copy link
Member

jeschkies commented Sep 30, 2016

For now this is a brain storming issue.

I believe our current thread pool is not optimal for processing render/ trace tasks.

For starters we should us template function as is clear from this little benchmark and this

boxdot, [30 Sep 2016, 15:33]: 
#include <functional>

template<typename Fun>
void caller(const Fun&& f) {
    f();
}

int main() {
    long counter1 = 0;
    long counter2 = 0;
    long counter3 = 0;
    long counter4 = 0;

    for(size_t i=0; i<10000000; i++) {
        auto lambda = [&]() {
            counter1++;
            counter2++;
            counter3++;
            counter4++;
        };
        caller(lambda);
    }
}

// ./a.out  0.00s user 0.00s system 0% cpu 0.001 total

More over we should avoid deep recursions with trace. My idea is too turn the recursive call in an iterative one. We should take inspiration from GPU renderers.

@jeschkies
Copy link
Member Author

The first step is to write our own pool that does not use std::function.

@jeschkies jeschkies self-assigned this Feb 12, 2017
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

No branches or pull requests

1 participant