2017-08-19 10:42 GMT+03:00  <ilia.galas...@gmail.com>:
> Thank your for explanations!!
> I would like to clarify a few moments.
>
> If I have 4 physical cores. The optimal number of paralell workers will be
> from 3 to 4 ?

The optimal number of workers depends a lot on the problem being
solved. Sometimes overcommitting is good, other times sticking to the
physical number of cores, or physical number of cores -1 or -2 is best
(depending on the number of control threads and other contention on
the system)

> I want to paralell several algorithms. The performance of those alogrithms
> from 5 to 7 seconds.
> When I divide this algorithm to chunks and create 3 or 4 workers, I get
> performance from 1.2 - 1.5 second per each chunk, but when I create more
> workers performance is getting slower.

>From 5-7 seconds to 1.2 - 1.5 seconds with 3-4 workers sounds like
good scaling: 3.33x - 5.8x.

The workers you create with emscripten_create_worker do not go away
automatically, but you need to call emscripten_destroy_worker() to
unload it. Creating and destroying workers for each task is not good,
but it is faster to precreate a pool of workers and reuse those, and
use emscripten_call_worker() to start the tasks. Creating 50 workers
at the same time would be way too much, unless your system had 30-50
cores.

> I create workers during startup and call them in runtime.
> I noticed that first worker call takes 0.4 - 0.6 second. Next calls take
> 0.05 seconds.

Due to JavaScript JIT effects, it is possible to see multiple calls to
emscripten_call_worker(), even with the same task, to take different
amount of time. On N first calls, the JIT optimizer will pick up
optimization info about the runs, and subsequent calls can become a
bit faster.

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to