Skip to content

Brainstorming: Rethink Threadpool and Workers #61

@jeschkies

Description

@jeschkies

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions