Re: [math] working on increasing performance for Math3

2021-05-21 Thread Gilles Sadowski
Ping. I've created a "neuralnet" module (for the ANN/SOFM functionality), in the "modularized_master" branch, that can be used as a template for the feature discussed in this thread. Are you still interested in implementing it? If so, I'd suggest commons-math-jdkmath for the name. It should be

Re: [math] working on increasing performance for Math3

2021-05-15 Thread Gilles Sadowski
Le mer. 12 mai 2021 à 13:23, Erik Svensson a écrit : > > Howdy all, > > Irrespective of how it's implemented we would like to implement the > performance improvements possible to the commons-math lib. > While I can certainly fork the project and we could have our own version of > commons-math, w

Re: [math] working on increasing performance for Math3

2021-05-12 Thread Gilles Sadowski
Hi. Le mer. 12 mai 2021 à 13:23, Erik Svensson a écrit : > > Howdy all, > > Irrespective of how it's implemented we would like to implement the > performance improvements possible to the commons-math lib. > While I can certainly fork the project and we could have our own version of > commons-ma

Re: [math] working on increasing performance for Math3

2021-05-12 Thread Erik Svensson
Howdy all, Irrespective of how it's implemented we would like to implement the performance improvements possible to the commons-math lib. While I can certainly fork the project and we could have our own version of commons-math, we would like to contribute. If there is no or little interest in a

Re: [math] working on increasing performance for Math3

2021-05-10 Thread Brett Okken
The explicit cast to primitive does not result in boxing/unboxing. It is the "magic" of PolymorphicSignature which actually adjusts to allow for primitives. On Mon, May 10, 2021 at 11:08 AM Erik Svensson wrote: > > > On 2021-05-10, 18:03, "Brett Okken" wrote: > > WARNING - External email; e

Re: [math] working on increasing performance for Math3

2021-05-10 Thread Erik Svensson
On 2021-05-10, 18:03, "Brett Okken" wrote: WARNING - External email; exercise caution. Perhaps it is an Intellij issue. The MethodHandle javadoc[1] has an "Usage examples" section. One of the examples shows calling List.size() (which returns an int): > Object x, y; String

Re: [math] working on increasing performance for Math3

2021-05-10 Thread Brett Okken
Perhaps it is an Intellij issue. The MethodHandle javadoc[1] has an "Usage examples" section. One of the examples shows calling List.size() (which returns an int): > Object x, y; String s; int i; > MethodType mt; MethodHandle mh; > MethodHandles.Lookup lookup = MethodHandles.lookup(); > ... > mt =

Re: [math] working on increasing performance for Math3

2021-05-10 Thread Erik Svensson
On 2021-05-10, 17:14, "Brett Okken" wrote: WARNING - External email; exercise caution. > Secondly, MethodHandle.invokeExact() takes and returns an object so there's a boxing/unboxing involved as well (as the Math/FastMath methods returns primitives). There is "magic" going on h

Re: [math] working on increasing performance for Math3

2021-05-10 Thread Brett Okken
> Secondly, MethodHandle.invokeExact() takes and returns an object so there's a > boxing/unboxing involved as well (as the Math/FastMath methods returns > primitives). There is "magic" going on here that actually avoids boxing. You can/should cast directly to the primitive type. That is what the

Re: [math] working on increasing performance for Math3

2021-05-10 Thread Erik Svensson
On 2021-05-10, 13:52, "Brett Okken" wrote: WARNING - External email; exercise caution. Out of curiosity, what specifically about MethodHandles use consumed the time? Was it the discovery/initialization or the steady-state usage? My observation has been that if the MH itself is st

Re: [math] working on increasing performance for Math3

2021-05-10 Thread Brett Okken
Out of curiosity, what specifically about MethodHandles use consumed the time? Was it the discovery/initialization or the steady-state usage? My observation has been that if the MH itself is static final and invokeExact is used, performance at steady-state is identical to making the call explicitly

Re: [math] working on increasing performance for Math3

2021-05-10 Thread Erik Svensson
Hello all! Some background: I work at a relatively well known fintech company and work with our clearing/risk products. They do a lot of calculations and performance is quite important to us. We have several libs that do the same thing and I was looking into a merger. So I wrote some JMH tests

Re: [math] working on increasing performance for Math3

2021-05-09 Thread Ralph Goers
> On May 8, 2021, at 5:14 AM, Gilles Sadowski wrote: > > Hello. > > Le sam. 8 mai 2021 à 08:42, Benjamin Marwell > a écrit : >> >> Instead of using byte buddy, why not just maven multi release jars? *1 > > Thanks for the suggestion. > Again, I don't know how to d

Re: [math] working on increasing performance for Math3

2021-05-08 Thread Gilles Sadowski
>> [...] > > It might make sense to update the FastMath Javadoc to clarify that the > main focus of the class is now accuracy (and portability?) rather than > speed. Done. > This should help manage user expectations. Yet the idea that though some API (TBD), an application could select which impl

Re: [math] working on increasing performance for Math3

2021-05-08 Thread sebb
On Sat, 8 May 2021 at 13:14, Gilles Sadowski wrote: > > Hello. > > Le sam. 8 mai 2021 à 08:42, Benjamin Marwell a écrit : > > > > Instead of using byte buddy, why not just maven multi release jars? *1 > > Thanks for the suggestion. > Again, I don't know how to do it concretely[1] nor the implicat

Re: [math] working on increasing performance for Math3

2021-05-08 Thread Gilles Sadowski
Hello. Le sam. 8 mai 2021 à 08:42, Benjamin Marwell a écrit : > > Instead of using byte buddy, why not just maven multi release jars? *1 Thanks for the suggestion. Again, I don't know how to do it concretely[1] nor the implications (IIRC, the mention of multi-release JARs was frowned upon some t

Re: [math] working on increasing performance for Math3

2021-05-07 Thread Benjamin Marwell
Instead of using byte buddy, why not just maven multi release jars? *1 The Java9+ impl will go to META-INF/java9 or so. We did that in the maven-jlink-plugin for example. *2 Will be much faster and work on Java 16+. Much easier to rest. Drawback: bad IDE support 1: https://maven.apache.org/plugin

Re: [math] working on increasing performance for Math3

2021-05-07 Thread Gilles Sadowski
Hello. Le ven. 7 mai 2021 à 10:52, Erik Svensson a écrit : > > Howdy all! > > > > I’m looking to do some work on FastMath Thanks for your interest. > to increase performance by using java.lang.Math where it is applicable (ie > where there is an @HotspotIntrinsicCandidate annotation on the meth

[math] working on increasing performance for Math3

2021-05-07 Thread Erik Svensson
Howdy all! I’m looking to do some work on FastMath to increase performance by using java.lang.Math where it is applicable (ie where there is an @HotspotIntrinsicCandidate annotation on the method). Since HIC was introduced in java 9 and the code needs to work on pre-java 9 and I don’t want to c