Closed Bug 983864 Opened 10 years ago Closed 9 years ago

Improve parallel performance for mandelbrot

Categories

(Core :: JavaScript Engine: JIT, defect)

30 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jaswanth.sreeram, Unassigned)

References

Details

Attachments

(1 file)

4.05 KB, application/x-javascript
Details
Attached file test-mandel.js
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0 (Beta/Release)
Build ID: 20140311030201

Steps to reproduce:

The attached testcase constructs the mandelbrot set using sequentially as well as in parallel using mapPar on an ArrayType.

Run this test case in the shell (configured with --enable-optimize).


Actual results:

Sequential execution takes 1518ms for 20 iterations (13.18 fps)
Parallel execution takes 1912ms for 20 iterations (10.46 fps)


Expected results:

Parallel execution should be faster than sequential execution on my 4-core(+HT) machine.
I've tried tuning this (number of cores, avoiding some global accesses from the parallel version that are local accesses in the sequential version, making the board larger) but the parallel version remains slower.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Worse than that, the number of cores has no impact on the time it takes, this is for a 512x512 board:

$ for i in 1 2 3 4 5 6 7 8; do
   ../../mozilla-central/js/src/build-release/js/src/js --thread-count=$i test-mandel.js
done
[parallel] : Took 5516 ms for 20 iterations - 3.63 fps
[parallel] : Took 5531 ms for 20 iterations - 3.62 fps
[parallel] : Took 5524 ms for 20 iterations - 3.62 fps
[parallel] : Took 5531 ms for 20 iterations - 3.62 fps
[parallel] : Took 5511 ms for 20 iterations - 3.63 fps
[parallel] : Took 5516 ms for 20 iterations - 3.63 fps
[parallel] : Took 5525 ms for 20 iterations - 3.62 fps
[parallel] : Took 5526 ms for 20 iterations - 3.62 fps
The Activity Viewer on Mac OS X shows pretty clearly that in all cases the program runs on a single core - it's not being parallelized at all.  This explains the timings, if nothing else :)  I'm not seeing any bailout messages but perhaps there's some warning printing issue...
The problem is the way the type is constructed.  Once constructed using new (new ArrayType(float64))(width*height) I get good speedup:

[parallel] : Took 5557 ms for 20 iterations - 3.60 fps
[parallel] : Took 3035 ms for 20 iterations - 6.59 fps
[parallel] : Took 2060 ms for 20 iterations - 9.71 fps
[parallel] : Took 1650 ms for 20 iterations - 12.12 fps
[parallel] : Took 1323 ms for 20 iterations - 15.12 fps
[parallel] : Took 1192 ms for 20 iterations - 16.78 fps
[parallel] : Took 1090 ms for 20 iterations - 18.35 fps
[parallel] : Took 1001 ms for 20 iterations - 19.98 fps
Re comment #4, that's 512x512 sheet, MacBook Pro, 4 cores x 2 hyperthreads.
Blocks: PJS
Depends on: 981547
Blocks: 981547
No longer depends on: 981547
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: