static private double my_cbrt(double x0) {
double x;
// Affinage de la première estimation
// celui ci-dessous est assez grossier, mais permet 10 chiffres de précision
// dans le range 10E-6 -> 10E6
// A CHECKER PLUS EN DETAIL : faire un vrai test de précision en bonne et due forme !!
if (x0>1000000) x=500;
else if (x0>1000) x=50;
else if (x0>1) x=5;
else if (x0>0.001) x=0.5;
else if (x0>0.000001) x=0.05;
else x = 0.005;
// Version Newton de base
// for(int i=0;i<10;i++) {
// x = 0.333333333333 * (2*x + x0/(x*x));
// }
// Version très légèrement plus rapide
x0 *= 0.333333333333;
for(int i=0;i<10;i++) {
x = 0.66666666666667 * x + x0/(x*x);
}
return x;
}--
You received this message because you are subscribed to the Google Groups "marlin-renderer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to marlin-renderer+unsubscribe@googlegroups.com.
To post to this group, send email to marlin-renderer@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thanks for your cbrt impl.I will write a jmh benchmark and extract the function domain range in Marlin (cubics roots finder).Stay tuned,Laurent
Le 6 nov. 2017 2:41 PM, "Olivier Brault" <o.br...@gmail.com> a écrit :
Hum maybe I was a little bit optimistic in my benchmark.--
In fact, this algorithm is a bit faster than Apach's one, but not 10 times ...
But still faster than Java one !
Le samedi 4 novembre 2017 11:14:46 UTC+1, Olivier Brault a écrit :Hi Laurent,
While profiling my app, I noticed that when drawing a lot of circles, Marlin made a lot of call to Math.cbrt() which is quite slow.
Did you try to use Apache FastMath.cbrt() instead ?
In my benchmark, the apache version is more than twice as fast as Java version.
Olivier
You received this message because you are subscribed to the Google Groups "marlin-renderer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to marlin-render...@googlegroups.com.
To post to this group, send email to marlin-...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to marlin-renderer+unsubscribe@googlegroups.com.
To post to this group, send email to marlin-renderer@googlegroups.com.
--
Laurent Bourgès
--
Laurent Bourgès
I dont know exactly how Marlin Renderer works.
In fact, I realized that a lot of call to cbrt() are made when drawing "big" circles : for "small" circles, my profiler didn't show this function in the report.
So, may be, the use of many call to cbrt by Marlin is done only in very particular situations, not really representative of common utilisation.
May be too, the profiler think Java spend a lot of time in cbrt() but it can be a callibration error or anything else I don't know.
To unsubscribe from this group and stop receiving emails from it, send an email to marlin-renderer+unsubscribe@googlegroups.com.
To post to this group, send email to marlin-renderer@googlegroups.com.