News for hackers. Stuff that matters.
Re:Improving math performance in glibc by Marat_Dukhan on Friday January 02, 2015 @06:28PM (#8829152)
Why not just merge the CRLibM implementations?
Re:Improving math performance in glibc by GFK_of_xmaspast on Friday January 02, 2015 @10:27PM (#8829822)
Are they actual improvements? The project looks like it's been dead almost five years.

(Second guess: ideology)

Re:Improving math performance in glibc by Marat_Dukhan on Friday January 02, 2015 @10:47PM (#8829863)
Implementations in CRLibM are correctly rounded (i.e. as accurate as possible) and are, in my benchmarks, faster than GNU LibM. Thus, they are a Pareto improvement over GNU LibM.
Re:Improving math performance in glibc by siddhesh on Saturday January 03, 2015 @02:32AM (#8830181)
The crlibm code is terrible to read and hence maintain. I had considered including crlibm too during my work but decided against it because it would be a lot more work.

Also, crlibm functions are provably correctly rounded only for univariate transcendentals (thanks to the worst case paper I cited in the blog). There is no such proof available for bivariate functions, which is why computing at an arbitrary very large precision (the way glibc does) is the only way to increase the likelihood of correctly rounded results. IIRC crlibm does not even try for bivariates.

I believe some documentation on the crlibm website cites benchmark numbers where IIRC glibc performs better (although not by much) in the fast paths of most functions they mention but gets hit really badly in the slow path. Slow path inputs are usually quite rare, but if your application/benchmark hits them regularly enough (especially sice the slow path is a factor of 1000 times worse) then you'll obviously conclude that the performance sucks and that crlibm is better.

Re:Improving math performance in glibc by Marat_Dukhan on Saturday January 03, 2015 @04:40PM (#8832094)
Sorry, I don't buy the argument that "code is terrible to read and hence maintain" from a GLibC developer. CRLibM does have a bunch or tricky macros to work-around bugs in decade-old compilers for architectures no one cares about, but GNU LibC is not any better in this aspect.

CRLibM does not have a provably correctly-rounded pow, but univariate functions can be merged.

The paper you cited is about decimal floating-point implementation, it is not relevant to the LibM functions discussed in the article.

I have a utility for benchmarking LibM libraries here: https://bitbucket.org/MDukhan/hysteria

Some benchmarks including CRLibM and GNU LibM are here: http://www.yeppp.info/benchmarks.html

Re:Improving math performance in glibc by siddhesh on Sunday January 04, 2015 @12:33AM (#8833489)
Yes the link is incorrect. I am working on getting that fixed.
Re:Improving math performance in glibc by derf_ on Saturday January 03, 2015 @08:14AM (#8830667)
In many contexts, the problem is not the absolute performance, but the variation in performance. For example, we want the Opus codec to be relatively insensitive to timing analysis, since Opus audio is often encrypted and transmitted over a network. Large variations represent an information leak that could be exploited by an external observer.

When we started looking at actual timings, we found that it was mostly pretty consistent, except for huge slowdowns in some frames. The cause? glibc's exp() slow path.

Re:Improving math performance in glibc by siddhesh on Sunday January 04, 2015 @12:38AM (#8833505)
We have had this in our todo list for a while. The leading idea currently is to provide compiler selectable function variants that don't fall into the multiple precision abyss. The biggest challenge here is to come up with data about accuracy of results without the mp path.
Re:Improving math performance in glibc by nullc on Saturday January 10, 2015 @09:49PM (#8868834)
For single precision single argument functions you can exhaustively test to obtain data about the accuracy of the results.
Re:Improving math performance in glibc by derf_ on Sunday January 04, 2015 @04:58AM (#8833977)
That's good to hear.