[OpenJDK Rasterizer] Marlin renderer contribution for review

Joseph D. Darcy joe.darcy at oracle.com
Thu Mar 26 23:05:14 UTC 2015


Hello,

Since JDK 7 the JDK has used a pure-Java implementation of floor and ceil:

     6908131 Pure Java implementations of StrictMath.floor(double) & 
StrictMath.ceil(double)
     https://bugs.openjdk.java.net/browse/JDK-6908131

So in this case I would suggest we follow the implications of Knuth's 
observation that "premature optimization is the root of all evil" and 
only look to further speed up floor / ceil if there is some appreciable 
performance problem  with them today as shown in benchmarks, etc.

Cheers,

-Joe

On 3/25/2015 2:44 PM, Phil Race wrote:
> FastMath: 
> http://cr.openjdk.java.net/~lbourges/marlin/marlin.3/src/java.desktop/share/classes/sun/java2d/marlin/FastMath.java.html 
>
>
> says its from here : http://www.java-gaming.org/index.php?topic=24194.0
>
> but that in turn may be from somewhere else unknown ..
>
> Aside from the provenance of the code, and even though its a 'trick' 
> rather than a body of code,
> other options are preferable, so it might be interesting to get Joe's 
> input on what other options
> there are that maintain correctness and give better performance - I 
> assume this gives
> a measurable benefit ?
>
> Is the limitation on the input range an issue ? There's no test here 
> for that, and
> correctness-wise this does seem to break down if the input is NaN.
>
> -phil.
>
> On 03/23/2015 09:14 AM, dalibor topic wrote:
>> I took a look at the webrev, and I have no objections, other than 
>> that src/java.desktop/share/classes/sun/java2d/marlin/FastMath.java 
>> seems to be based off third party code with an unknown license.
>>
>> So that class should be removed in the next iteration.
>>
>> It may be worth filing a bug to optimize Math.* performance in 
>> general with respect to known classes of inputs instead. 
>> Alternatively, StrictMath versions of these methods should be in pure 
>> Java, and avoid the JNI invocation penalty, so could be worth a try 
>> as well.
>>
>> cheers,
>> dalibor topic
>>
>> On 19.03.2015 00:25, Laurent Bourgès wrote:
>>> Jim,
>>>
>>> Here is the new webrev:
>>> http://cr.openjdk.java.net/~lbourges/marlin/marlin.3/
>>>
>>> Changes:
>>> - discussed changes in Dasher, Stroker, TransformingPathConsumer2D
>>> - indentation, line breaks (continuation lines)
>>> - revert many float suffix in math operations (useless ? does the
>>> compiler make conversions ?)
>>>
>>> Hope it looks better ...
>>>
>>> Good night,
>>> Laurent
>>
>



More information about the graphics-rasterizer-dev mailing list