You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var h = g1.pow(x).compute();
var C = h.op(g2.pow(y)).compute();
Currently, this will (unless thread scheduling gets weird) cause computation of C to wait for the computation of h to finish before starting its own computation, i.e. the time-cost of the lines above is basically two exponentiations.
However, ideally (given you have two processors), the computation of C wouldn't wait for h, but instead immediately start with the multiexponentiation. In total, this would result in more group operations done, but the time to compute the lines would decrease to max(one pow, one multiexp) because of parallelism. So that would be faster than the current approach.
However, there may also be cases where it's stupid not to wait for a (sub-)computation to finish. For example (assume two cores):
var h = g1.pow(x).op(g3.pow(z)).compute();
var h2 = g1.pow(x).compute();
var C = h.op(g2.pow(y)).compute();
In this case, h and h2 are being computed in parallel. h2 would finish first, then C would start computing. It's likely that at that point, h is almost finished computing, so for C it's likely better to wait a short time for h instead of re-doing everything that h has already almost finished, anyway.
The text was updated successfully, but these errors were encountered:
Actually, writing this I now notice that the best way to resolve the first scenario is actually to wait for h to be computed, but already finish computing the rest of C anyway. This way, the time cost is just one exponentiation (two in parallel).
Consider the following code using the
LazyGroup
:Currently, this will (unless thread scheduling gets weird) cause computation of
C
to wait for the computation ofh
to finish before starting its own computation, i.e. the time-cost of the lines above is basically two exponentiations.However, ideally (given you have two processors), the computation of C wouldn't wait for h, but instead immediately start with the multiexponentiation. In total, this would result in more group operations done, but the time to compute the lines would decrease to max(one pow, one multiexp) because of parallelism. So that would be faster than the current approach.
However, there may also be cases where it's stupid not to wait for a (sub-)computation to finish. For example (assume two cores):
In this case,
h
andh2
are being computed in parallel.h2
would finish first, thenC
would start computing. It's likely that at that point,h
is almost finished computing, so forC
it's likely better to wait a short time forh
instead of re-doing everything thath
has already almost finished, anyway.The text was updated successfully, but these errors were encountered: