[OpenJDK 2D-Dev] [OpenJDK Rasterizer] Path2d needRoom very slow for huge paths

Jim Graham james.graham at oracle.com
Wed Apr 22 23:16:25 UTC 2015


Hi Laurent,

The same copyOf() change would apply to the method that grows the types 
array.

I created https://bugs.openjdk.java.net/browse/JDK-8078464 for this part 
of the fix...

		...jim

On 4/22/15 1:22 PM, Laurent Bourgès wrote:
> Jim,
>
> Here is a new webrev to improve the grow algorithm of Path2D needRoom()
> and handle properly overflow:
> http://cr.openjdk.java.net/~lbourges/path2D/Path2D_needRoom.2/
>
> Changes:
> - fixed condition in needRoom() methods to avoid overflow
> - use Arrays.copyOf(oldCoords, newSize) in expandCoords() methods
> instead of manual allocation + arraycopy
>
>
> Path2DGrow results:
> UNPATCHED:
>   - Test(Path2D.Double[0]) ---
> testAddMoves[1000000] duration= 20.046456 ms.
> *testAddLines[1000000] duration= 2744.025722 ms.
> testAddQuads[1000000] duration= 10289.854596 ms.
> testAddCubics[1000000] duration= 23120.553993999998 ms.
> testAddMoveAndCloses[1000000] duration= 3076.952691 ms.
> *...
>
> PATCHED:
>   - Test(Path2D.Double[0]) ---
> testAddMoves[1000000] duration= 21.808374 ms.
> *testAddLines[1000000] duration= 60.566691 ms.
> testAddQuads[1000000] duration= 105.996736 ms.
> testAddCubics[1000000] duration= 146.004722 ms.
> testAddMoveAndCloses[1000000] duration= 64.536282 ms.
> *...
>
>     Le 21 avr. 2015 19:56, "Jim Graham" <james.graham at oracle.com
>     <mailto:james.graham at oracle.com>> a écrit :
>
>     > Then it might make sense to make a new bug and target the existing patch at it by just removing the new method signature...
>
> Could you create the new bug and update the bugid in the Path2DGrow test
> (@bug TODO) ?
>
> If you (and phil) approve the patch, please push it for me in JDK9 and
> request a backport to JDK8.
>
> Laurent



More information about the 2d-dev mailing list