On Sat, Aug 22, 2009 at 10:48 AM, Dr. David Kirkby
<david.kir...@onetel.net>wrote:

>
> Dr. David Kirkby wrote:
> > Has anyone ever thought of developing a Sage benchmark, so allowing
> > different hardware to be compared in running Sage? If people are setting
> > up a Sage server, it would be sensible they have some idea of the
> > performance of various hardware.
> >
> > Mathematica has one built in, which tests 15 things.
> >
> > Data Fitting
> > Digits of Pi
> > Discrete Fourier Transform
> > Eignenvalues of a matrix
> > Elementary functions
> > Gamma function
> > Large integer multiplication
> > Matrix Arithmetic
> > Matrix Transpose
> > Numerical Integration
> > Polynomial expansion.
> > Random number sort
> > Singular Value Decomposition
> > Solving a linear system.
> >
> > Data is referenced to a 2.4 GHz Pentium 4 running XP.
> >
> > Obviously the code for that is propriety.
> >
> > But there are Mathematica benchmarks around, the most popular of which
> > seems to be
> >
> > http://www2.staff.fh-vorarlberg.ac.at/~ku/karl/mma.html<http://www2.staff.fh-vorarlberg.ac.at/%7Eku/karl/mma.html>
> >
> > The license for the latter is not stated, so I just emailed the author
> > to ask if he would release it under the GPL.
> >
> >
> > Dave
>
> I got a reply from Karl Unterkofler who has developed that Mathematica
> benchmark which appears to be quite widely used.
>
> http://www2.staff.fh-vorarlberg.ac.at/~ku/karl/mma.html<http://www2.staff.fh-vorarlberg.ac.at/%7Eku/karl/mma.html>
>
> He has no problem if we wanted to adapt his benchmark for Sage, though
> he would appreciate a reference to the original source.
>
> You can see what his latest version does here:
> http://www2.staff.fh-vorarlberg.ac.at/~ku/karl/timings70.html<http://www2.staff.fh-vorarlberg.ac.at/%7Eku/karl/timings70.html>
>
>
>    1.  Timing[N[Pi, 5000000]]][[1]]
>    2. Timing[N[Sin[1/2], 3000000]][[1]]
>    3. Timing[10000000!][[1]]
>    4. Timing[FactorInteger[2^256 - 1]][[1]]
>    5. Timing[PrimeQ[2^19937 - 1]][[1]]


Here are the first 5 and number 17:

time a = N(pi, 5000000)
time a = N(sin(1/2), 3000000)
time a = factorial(10000000)
time a = factor(2^256 - 1)
time a = is_prime(2^19937 - 1)

# test 17:
sage: R.<a1,a2,a3,a4,a5,a6,a7> = QQ[]
sage: time f=(a1 + a2 + a3 + a4 + a5 + a6 + a7)^29
CPU times: user 26.90 s, sys: 1.20 s, total: 28.10 s
Wall time: 34.55 s


If this is a widely used benchmark, Mathematica may have been tuned by
Wolfram Inc to do well on these problems, so it might be worth varying some
parameters.

On my laptop (OS X 64-bit Sage-4.1.1 and Mathematica 7.0):

Test 1 -- sage (=mpfr) wins

SAGE:
sage: time a = N(pi, 5000000)
CPU times: user 10.31 s, sys: 0.94 s, total: 11.26 s
Wall time: 11.73 s

MATHEMATICA:
In[1]:= Timing[N[Pi, 5000000]]][[1]]
Out[1]= 11.3116

------------------------------------
Test 2 -- sage (=mpfr) loses

SAGE:
sage: time a = N(sin(1/2), 3000000)
CPU times: user 26.34 s, sys: 2.39 s, total: 28.73 s

MATHEMATICA:
In[14]:= Timing[N[Sin[1/2], 3000000]][[1]]
Out[14]= 11.5776

------------------------------------

Test 3 -- sage (=MPIR in this case) wins

SAGE:

sage: time a = factorial(10000000)
CPU times: user 13.79 s, sys: 1.04 s, total: 14.83 s

MATHEMATICA:

In[12]:= Timing[10000000!][[1]]
 Out[12]= 19.2908

------------------------------------

Test 4 -- Sage (=PARI) wins

SAGE
sage: time a = factor(2^256 - 1)
CPU times: user 2.94 s, sys: 0.10 s, total: 3.04 s

MATHEMATICA:
In[10]:= Timing[FactorInteger[2^256 - 1]]
Out[10]= {3.81266,...


------------------------------------

Test 5 -- Sage (=PARI) wins by a lot

SAGE:

sage: time a = is_prime(2^19937 - 1)
[i give up after about 40 seconds]
but...
sage: time a = is_pseudoprime(2^19937 - 1)
CPU times: user 16.61 s, sys: 0.56 s, total: 17.17 s

MATHEMATICA:
In[11]:= Timing[PrimeQ[2^19937 - 1]][1]
Out[11]= {28.2604, True}[1]


I checked and the docs for PrimeQ say it returns True if and only if the
input number is prime.  Been it points at the implementation notes, which
describes the primality test they implement at it is only a pseudoprimality
test.  I.e., Mathematica's PrimeQ is really like Sage's is_pseudoprime,
despite their very misleading docs.

---------------------------

Test 17 -- expanding a symbolic expression: Sage = Singular is slightly
slower

sage: R.<a1,a2,a3,a4,a5,a6,a7> = QQ[]
sage: time f=(a1 + a2 + a3 + a4 + a5 + a6 + a7)^29
CPU times: user 26.90 s, sys: 1.20 s, total: 28.10 s

In[15]:= Timing[Expand[(a1 + a2 + a3 + a4 + a5 + a6 + a7)^29]][[1]]
Out[15]= 24.2602
---------------------------

So Sage wins 4 out 6 of the benchmarks on my laptop at least (a new Macbook
Air).

-- William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to