DescriptionAdd sk_parallel_for()
This should be a drop-in replacement for most for-loops to make them run in parallel:
for (int i = 0; i < N; i++) { code... }
~~~>
sk_parallel_for(N, [&](int i) { code... });
This is just syntax sugar over SkTaskGroup to make this use case really easy to write.
There's no more overhead that we weren't already forced to add using an interface like batch(),
and no extra heap allocations.
I've replaced 3 uses of SkTaskGroup with sk_parallel_for:
1) My unit tests for SkOnce.
2) Cary's path fuzzer.
3) SkMultiPictureDraw.
Performance should be the same. Please compare left and right for readability. :)
BUG=skia:
No public API changes.
TBR=reed@google.com
Committed: https://skia.googlesource.com/skia/+/00b621cfc0dac2a0028757a974de33a78bb8579d
Patch Set 1 #Patch Set 2 : tweaks #Patch Set 3 : more #Patch Set 4 : unused #Patch Set 5 : start == 0 #Patch Set 6 : Port SamplePathFuzz #Patch Set 7 : Explicit function pointer types. #Patch Set 8 : port more, bail out if end <= 0 #
Total comments: 2
Patch Set 9 : rebase #Patch Set 10 : fix #
Messages
Total messages: 27 (13 generated)
|