oldk1331 wrote:
> 
> I said before that the following test takes too much time to run:
>      testIntegrate("sqrt(tan(x)^2 + 2*tan(x) + 2)", "x", "alg")
> 
> I did some profiling, and found that 40% time is spent in
> symmetricRemainder:
> 
>                                 Callers
>                   Total.     Function
>   Count     %  Count     %      Callees
> ------------------------------------------------------------------------
>       3   0.0                   |MODRING;reduce;RMod$;6| [76]
>      13   0.1                   |INS-;symmetricRemainder;3S;27| [1]
>    3431  39.3                   |IDPO;map;M2$;6| [5]
>    1104  12.7   3451  39.6   |INS-;symmetricRemainder;3S;27| [1]
>      13   0.1                   |INS-;symmetricRemainder;3S;27| [1]
>     160   1.8                   |INT;=;2$B;30| [4]
>     149   1.7                   |ABELMON-;*;Pi2S;2| [14]
>      67   0.8                   SB-VM::ALLOC-TRAMP [15]
>     228   2.6                   |ORDSET-;>;2SB;4| [7]
>     173   2.0                   |ORDSET-;<=;2SB;6| [20]
>      73   0.8                   |INT;+;3$;34| [9]
>     160   1.8                   |INT;*;3$;37| [6]
>     180   2.1                   |ABELGRP-;*;Nni2S;3| [11]
>     366   4.2                   |INT;rem;3$;44| [16]
>     369   4.2                   IDENTITY [2]
>     407   4.7                   |INT;<;2$B;31| [3]
> 
> 
> We can see that "=$INT, +$INT, *$INT, <$INT" are not inlined, and
> "*$ABELMON, *$ABELGRP, >, <=" are not defined in INT, thus impossible
> to get inlined.
> 
> So I want to add inline optimization for these functions.
> (I also add inline support for "positive?, even?, ^")
> 
> =========== test case
> )time on
> )lisp (require :sb-sprof)
> 
> f := sqrt(tan(x)^2 + 2*tan(x) + 2)
> g := integrate(f, x)
> 
> f2 := D(g, x)
> 
> )lisp (sb-sprof:start-profiling)
> normalize(f-f2)
> )lisp (sb-sprof:stop-profiling)
> 
> )lisp (sb-sprof:report)
> ===========
> 
> Benchmark result:
>                  D(g, x)    normalize(f-f2)
> before patch    40.3 s      87.4 s
> after patch     28.4 s      57.3 s
> 
> So it's 30% faster, saves 40 seconds in testing.

OK, good.  But I see some funny formatting below, which may be
due tabs.  Please make sure there are no tabs when you commit.

> 
> diff --git a/src/algebra/integer.spad b/src/algebra/integer.spad
> index 0e619c2f..35f673b2 100644
> --- a/src/algebra/integer.spad
> +++ b/src/algebra/integer.spad
> @@ -59,7 +59,6 @@
>         ZP ==> SparseUnivariatePolynomial %
>         ZZP ==> SparseUnivariatePolynomial Integer
>         x, y : %
> -      n : NonNegativeInteger
         ^^^^^^
Would be indentation error if real.

-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to