javafx.scene.shape.Path (memory) inefficient PathElements

Laurent Bourgès bourges.laurent at
Fri May 5 07:45:10 UTC 2017


There is a Path2d class (double) in the package used
internally by prism but it is not directly accessible from the public scene
Maybe a new public Shape implementation only wrapping a Path2d would help ?
I could try making a prototype for OpenJFX10.

In dec 2016, I integrated MarlinFX which uses double-precision to convert
path elements so it is worth to keep double values for path coordinates.

>> As an experiment (and because we are still on Java8 we can easily do
>> that) was that we created our own Shape-Subclass who:
>> * uses floats (there's no reason to use double in the SG when the
>>   backing API - Path2D - is float based)
>> * passes the floats directly to the Path2D/NGPath API
>> Guess what: We now need 2.5MB / page which means 27.5MB is the overhead
>> added by the current Path-API - ouch!
Excellent proof of concept.

For OpenJFX10, I except Value Types will be ready and such path elements
would be the perfect candidate for Java array of structs ie packed
point/segment/curve values.
That would be awesome and should reduce the memory footprint to its minimum.

Jim do you think that the Vahalla project would be give us such benefits ?


More information about the openjfx-dev mailing list