Possibly related: I can reproduce a massive (90%) performance drop on OSX between drawing a wireframe polygon on a Canvas using a series of gc.strokeLine(double x1, double y1, double x2, double y2) commands versus using a single gc.strokePolygon(double[] xPoints, double[] yPoints, int count) command.
Creating the polygons manually with strokeLine() is significantly faster using the ES2Pipeline on OSX. This is reproducible in a little GitHub JavaFX benchmarking project I've created: https://github.com/chriswhocodes/DemoFX Build with ant Run with: # use strokeLine ./run.sh -c 5000 -m line result: 60 (sixty) fps # use strokePolygon ./run.sh -c 5000 -m poly result: 6 (six) fps System is 2011 iMac 27" / Mavericks / 3.4GHz Core i7 / 20GB RAM / Radeon 6970M 1024MB Looking at the code paths in javafx.scene.canvas.GraphicsContext: gc.strokeLine() maps to writeOp4(x1, y1, x2, y2, NGCanvas.STROKE_LINE) gc.strokePolygon() maps to writePoly(xPoints, yPoints, nPoints, true, NGCanvas.STROKE_PATH) which involves significantly more work with adding to and flushing a GrowableDataBuffer. I've not had time to dig any deeper than this but it's surely a bug when building a poly manually is 10x faster than using the convenience method. Cheers, Chris On Fri, March 27, 2015 21:26, Tobias Bley wrote: > In my opinion the whole graphics performance on MacOSX isnât good at > all with JavaFXâ¦. > > >> Am 27.03.2015 um 22:10 schrieb Robert Krüger <krue...@lesspain.de>: >> >> >> The bad full screen performance is without the arcs. It is just one >> call to fillRect, two to strokeOval and one to fillOval, that's all. I >> will build a simple test case and file an issue. >> >> On Fri, Mar 27, 2015 at 9:58 PM, Jim Graham <james.gra...@oracle.com> >> wrote: >> >> >>> Hi Robert, >>> >>> >>> Please file a Jira issue with a simple test case. Arcs are handled >>> as a generalized shape rather than via a predetermined shader, but it >>> shouldn't be that slow. Something else may be going on. >>> >>> Another test might be to replace the arcs with rectangles or ellipses >>> and see if the performance changes... >>> >>> ...jim >>> >>> >>> >>> On 3/27/15 1:52 PM, Robert Krüger wrote: >>> >>> >>>> Hi, >>>> >>>> >>>> I have a super-simple animation implemented using AnimationTimer >>>> and Canvas >>>> where the canvas just performs a few draw operations, i.e. fills the >>>> screen with a color and then draws and fills 2-3 circles and I have >>>> already observed that each drawing operation I add, results in >>>> significant CPU load (e.g. when I draw < 10 arcs in addition to the >>>> circles, the CPU load goes up to 30-40% on a Mac Book Pro for a >>>> Canvas size of 600x600(!). >>>> >>>> >>>> Now I tested the animation in full screen mode (only with a few >>>> circles) and playback is unusable for a serious application (very >>>> choppy). Is 2D canvas performance known to be very bad on Mac or am >>>> I doing something >>>> wrong? Are there workarounds for this? >>>> >>>> Thanks, >>>> >>>> >>>> Robert >>>> >>>> >>>> >> >> >> -- >> Robert Krüger >> Managing Partner >> Lesspain GmbH & Co. KG >> >> >> www.lesspain-software.com > >