Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Issue 1184373003: Add sk_parallel_for() (Closed)

Created:
5 years, 6 months ago by mtklein_C
Modified:
5 years, 6 months ago
Reviewers:
mtklein, caryclark, reed1
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Add 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+136 lines, -164 lines) Patch
M include/core/SkMultiPictureDraw.h View 1 2 3 1 chunk +0 lines, -2 lines 0 comments Download
M samplecode/SamplePathFuzz.cpp View 1 2 3 4 5 2 chunks +25 lines, -36 lines 0 comments Download
M src/core/SkMultiPictureDraw.cpp View 1 2 3 4 1 chunk +7 lines, -8 lines 0 comments Download
M src/core/SkTaskGroup.h View 1 2 3 4 5 6 7 8 9 2 chunks +39 lines, -0 lines 0 comments Download
M src/core/SkTaskGroup.cpp View 1 2 3 4 5 6 7 8 9 3 chunks +15 lines, -5 lines 0 comments Download
M tests/LazyPtrTest.cpp View 1 2 3 4 5 6 7 2 chunks +15 lines, -25 lines 0 comments Download
M tests/OnceTest.cpp View 1 2 3 4 5 6 1 chunk +5 lines, -33 lines 0 comments Download
M tests/PathOpsExtendedTest.cpp View 1 2 3 4 5 6 7 1 chunk +0 lines, -1 line 0 comments Download
M tests/PathOpsSkpClipTest.cpp View 1 2 3 4 5 6 7 1 chunk +5 lines, -4 lines 0 comments Download
M tests/PathOpsThreadedCommon.cpp View 1 2 3 4 5 6 7 1 chunk +3 lines, -4 lines 0 comments Download
M tests/SkpSkGrTest.cpp View 1 2 3 4 5 6 7 3 chunks +15 lines, -7 lines 0 comments Download
M tools/skpdiff/SkDiffContext.cpp View 1 2 3 4 5 6 7 4 chunks +7 lines, -39 lines 0 comments Download

Messages

Total messages: 27 (13 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1184373003/100001
5 years, 6 months ago (2015-06-16 17:25:24 UTC) #2
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Build-Win-MSVC-x86-Debug-Trybot on client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Win-MSVC-x86-Debug-Trybot/builds/1534)
5 years, 6 months ago (2015-06-16 17:28:39 UTC) #4
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1184373003/120001
5 years, 6 months ago (2015-06-16 17:33:54 UTC) #6
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 6 months ago (2015-06-16 17:39:04 UTC) #8
mtklein_C
5 years, 6 months ago (2015-06-16 17:39:49 UTC) #10
mtklein
Couldn't help myself... ported almost all the other uses of SkTaskGroup too.
5 years, 6 months ago (2015-06-16 18:03:58 UTC) #12
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1184373003/130001
5 years, 6 months ago (2015-06-16 18:04:29 UTC) #14
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 6 months ago (2015-06-16 18:09:34 UTC) #16
mtklein
+Cary, I ended up editing a lot of code you wrote. Might want to have ...
5 years, 6 months ago (2015-06-16 18:56:45 UTC) #18
caryclark
lgtm https://codereview.chromium.org/1184373003/diff/130001/src/core/SkTaskGroup.cpp File src/core/SkTaskGroup.cpp (right): https://codereview.chromium.org/1184373003/diff/130001/src/core/SkTaskGroup.cpp#newcode2 src/core/SkTaskGroup.cpp:2: * Copyright 2014 Google Inc. 2015? (Not sure ...
5 years, 6 months ago (2015-06-16 19:04:25 UTC) #19
mtklein
https://codereview.chromium.org/1184373003/diff/130001/src/core/SkTaskGroup.cpp File src/core/SkTaskGroup.cpp (right): https://codereview.chromium.org/1184373003/diff/130001/src/core/SkTaskGroup.cpp#newcode2 src/core/SkTaskGroup.cpp:2: * Copyright 2014 Google Inc. On 2015/06/16 19:04:25, caryclark ...
5 years, 6 months ago (2015-06-16 19:16:21 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1184373003/170001
5 years, 6 months ago (2015-06-17 22:20:50 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1184373003/170001
5 years, 6 months ago (2015-06-17 22:22:20 UTC) #26
commit-bot: I haz the power
5 years, 6 months ago (2015-06-17 22:26:20 UTC) #27
Message was sent while issue was closed.
Committed patchset #10 (id:170001) as
https://skia.googlesource.com/skia/+/00b621cfc0dac2a0028757a974de33a78bb8579d

Powered by Google App Engine
This is Rietveld 408576698