Closed Bug 906773 Opened 8 years ago Closed 8 years ago

PJS: New "ComputeSliceBounds" function in ParallelArray.js

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: dbonetta, Assigned: dbonetta)

References

Details

Attachments

(1 file, 2 obsolete files)

This patch includes an improved version of the "ComputeSliceBounds" function used to split the ParallelArray. The new version assigns tasks to parallel workers more efficiently.
Attached patch bug-906773-fix.patch (obsolete) — Splinter Review
Blocks: PJS
Summary: New "ComputeSliceBounds" function in ParallelArray.js → PJS: New "ComputeSliceBounds" function in ParallelArray.js
Comment on attachment 792309 [details] [diff] [review]
bug-906773-fix.patch

Review of attachment 792309 [details] [diff] [review]:
-----------------------------------------------------------------

Marking Shu for review.

::: js/src/builtin/ParallelArray.js
@@ +56,5 @@
>  function ComputeSliceBounds(numItems, sliceIndex, numSlices) {
>    var sliceWidth = (numItems / numSlices) | 0;
> +  var extraChunks = (numItems % numSlices) | 0;
> +
> +  var startIndex = sliceWidth * sliceIndex + Math.min(extraChunks, sliceIndex);

Math.min should be std_Math_min.

@@ +83,5 @@
> +    ARRAY_PUSH(info, SLICE_INFO(counter, counter + sliceWidth + 1));
> +    counter += sliceWidth + 1;
> +  }
> +  for (; i < numSlices; i++) {
> +    ARRAY_PUSH(info, SLICE_INFO(counter, counter + sliceWidth));    

nit: whitespace at the end.
Attachment #792309 - Flags: review?(shu)
Comment on attachment 792309 [details] [diff] [review]
bug-906773-fix.patch

Review of attachment 792309 [details] [diff] [review]:
-----------------------------------------------------------------

Marking as r+, presuming that sankha93 comments are addressed
Attachment #792309 - Flags: review?(shu) → review+
Attached patch bug-906773-fix.patch (obsolete) — Splinter Review
Attachment #792309 - Attachment is obsolete: true
Oh, this wasn't pushed. I updated the commit message and marking checkin-needed.
Attachment #792473 - Attachment is obsolete: true
Assignee: general → dbonetta
https://hg.mozilla.org/mozilla-central/rev/fda5c46503d1
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.