chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance question concerning chicken flonum vs "foreign flonum"


From: Christian Himpe
Subject: Re: Performance question concerning chicken flonum vs "foreign flonum"
Date: Fri, 08 Apr 2022 23:19:43 +0200 (CEST)

Christian Himpe schrieb am 2021-11-07:

> felix.winkelmann@bevuta.com schrieb am 2021-11-07:
> > > Dear Felix,
> > >
> > > Thank you for the patch. I built the current git head with your patch.
> > > After importing chicken.flonum, I get the following error when calling 
> > > fp*+:
> > >

> > I'm terribly sorry. I'm an ass, I didn't even test it in the interpreter. 
> > Please
> > find attached a revised patch.


> > felix

> Dear felix,

> the latest patch works. I extended my test code and here are the results:

> without -C -mfma:

> csc -O5 -d0 -C -O3 fma-test.scm && ./fma-test
> 7.998s CPU time, 0/225861 GCs (major/minor), maximum live heap: 30.78 MiB
> 10.104s CPU time, 0/256410 GCs (major/minor), maximum live heap: 30.78 MiB
> 10.69s CPU time, 0/311364 GCs (major/minor), maximum live heap: 30.78 MiB

> with -C -mfma:

> csc -O5 -d0 -C -O3 -C -mfma fma-test.scm && ./fma-test
> 7.697s CPU time, 0/238095 GCs (major/minor), maximum live heap: 30.78 MiB
> 9.135s CPU time, 0/262467 GCs (major/minor), maximum live heap: 30.78 MiB
> 11.008s CPU time, 0/317460 GCs (major/minor), maximum live heap: 30.78 MiB

> It seems the number of GCs is a lot higher than for fp*/fp+ or c99-fma with 
> or without fma compiler flag. So currently, there seems to be no benefit 
> integrating c99's fma as fp*+ besides a slightly better rounding error. At 
> least for me, this comes unexpected.

> Thank you for providing the patch. If you want to test something in this 
> regard in the future, I am happy to test further patches.

> Cheers

> Christian

Dear felix,

after coming back to this function and the associated issues regularly, I 
revised my opinion on integrating"fp+*" into (chicken flonum), given it uses 
the C99-fma function. On the one hand, this operation is so fundamental in 
numerical computations that it warrants a specialized function, on the other 
hand the (somewhat) improved rounding could help a little. Finally, Gauche ( 
https://practical-scheme.net/gauche/man/gauche-refe/R7RS-large.html#index-fl_002b_002a
 ) and MIT Scheme ( 
https://www.gnu.org/software/mit-scheme/documentation/stable/mit-scheme-ref.html#Flonum-Operations
 ) provide this functionality. All in all, I would really appreciate if an 
inclusion of a fma-based "fp+*" function into the (chicken flonum) module could 
be considered in future versions of CHICKEN Scheme. Maybe your provided patch 
reduces the effort for this.

Thank you very much

Christian 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]