Tour - Benchmarks

Here are some comparisons of Sage with other systems. Each pair of comparison was made on the same system and it was carfully avoided to hit swap memory to avoid accidental slowdows. Unless otherwise noted, all timings are in seconds.
Links: List of Computations where Sage is Noticeably Faster than Magma...

Multiply Integers $$({12345}^{678900} - 1) * ({67890}^{123456} - 1)$$

Sage 4.1.1
sage: a1 = 12345^678900 - 1
sage: a2 = 67890^123456 - 1
sage: len(str(a1))
2777714
sage: len(str(a2))
596516
sage: %timeit a1*a2
10 loops, best of 3: 278 ms per loop
Mathematica 7
In[2]:= a1 = 12345^678900 - 1;
In[3]:= a2 = 67890^123456 - 1;
In[4]:= Timing[a1*a2][[1]]
Out[4]= 0.368023
Note: "ms" is Milliseconds ($$10^{-3}$$).
Sage is 32% faster.
System: Intel 32bit, Linux

factorial 10000000!

Sage 4.1.1
sage: time a = factorial(10000000) 
CPU times: user 13.79 s,...
Mathematica 7
In[12]:= Timing[10000000!][[1]] 
Out[12]= 19.2908 
Sage is 40% faster.
System: Mac OSX

Integer Factorization of $$2^{512} - 1$$

Sage 4.1.1
sage: time a = factor(2^512 - 1) 
CPU times: user 92.29 s,...
Mathematica 7
In[10]:= Timing[FactorInteger[2^512 - 1]][[1]]
Out[10]= 346.494 
System: Intel 32bit, Linux
Sage is nearly 4 times faster.

Bernoulli Number $$3 * 10^5$$

Sage 4.1.1
sage: %time _ = bernoulli(3*10^5)
CPU times: user 141.04 s,...
David Harvey, A multimodular algorithm for computing Bernoulli numbers, 2008
Mathematica 7
In[1]:= Timing[BernoulliB[3*10^5]][[1]]
Out[1]= 214.842
Wolfram Blog about Bernoulli Numbers
System: Intel 32bit, Linux
Sage is 52% faster.

5 Million Digits of $$\pi$$

Sage 4.1.1 (pure and using mpmath)
sage: time a = N(pi, digits=5000000) 
CPU times: user 28.90 s,...
Wall time: 28.96 s

However, mpmath is (barely) faster than Mathematica: 
sage: from sage.libs.mpmath.all import pi as p 
sage: time a = p(dps=5000000) 
CPU times: user 12.56 s,...
Wall time: 12.70 s 
Mathematica 7
In[1]:= Timing[N[Pi, 5000000]][[1]] 
Out[1]= 13.21

Pseudoprimality Test $$2^{19937} - 1$$

Sage 4.1.1
sage: time a = is_pseudoprime(2^19937 - 1) 
CPU times: user 16.61 s,...
Mathematica 7
In[11]:= Timing[PrimeQ[2^19937 - 1]][1]
Out[11]= {28.2604, True}[1]

Expanding a Symbolic Expression

Sage 4.1.1
sage: R.<a1,a2,a3,a4,a5,a6,a7> = QQ[] 
sage: time f = (a1+a2+a3+a4+a5+a6+a7)^25
CPU times: user 8.56 s,...
Wall time: 8.97 s

sage: var('a1 a2 a3 a4 a5 a6 a7')
(a1, a2, a3, a4, a5, a6, a7)
sage: time f = expand((a1+a2+a3+a4+a5+a6+a7)^25)
CPU times: user 19.94 s,...
Wall time: 20.59 s
Mathematica 7
In[15]:= Timing[Expand[(a1+a2+a3+a4+a5+a6+a7)^25]][[1]]
Out[15]= 15.981
System: Intel 32bit, Linux

Expanding a Polynomial over $$GF(13)$$

Sage 4.1.1
sage: R.<x,y,z> = PolynomialRing(GF(13)) 
sage: time _ = expand((x+y+z+1)**100) 
CPU times: user 0.07 s,...
Mathematica 7
In[1]:= Timing[Expand[(x+y+z+1)^100, Modulus -> 13]][[1]] 
Out[1]= 4.20826
Sage is 60 times faster.
System: Intel 32bit, Linux

Multiply and Add Random Boolean Matrices in $$GF(2)$$

Sage 4.1.1
sage: m1 = random_matrix(GF(2), 1000, 1000) 
sage: m2 = random_matrix(GF(2), 1000, 1000) 
sage: %timeit m1*m2
100 loops, best of 3: 9.76 ms per loop
sage: %timeit m1+m2
1000 loops, best of 3: 344 µs per loop

M4RI Performance Comparisons
More about Matrix Multiplications (Sage Days 7/LinAlg)
Mathematica 7
In[15]:= m1 := RandomInteger[{0,1},{1000, 1000}] 
In[16]:= m2 := RandomInteger[{0,1},{1000, 1000}] 
In[17]:= Timing[Mod[m1.m2, 2]][[1]] 
Out[17]= 30.7219
In[18]:= Timing[Mod[m1+m2, 2]][[1]] 
Out[18]= 0.060003 

Magma
Sage vs. Magma for this particular type of problem.
Note: "ms" is Milliseconds ($$10^{-3} s$$); "µs" is Microseconds ($$10^{-6} s$$)
System: Intel 32bit, Linux
Sage is about 3000 times faster.

Matrix Multiplication in Sage vs. MATLAB and Mathematica

Sage 4.1.2
age:  a = random_matrix(RDF,2000) 
sage: timeit('a*a') 
5 loops, best of 3: 3.28 s per loop 
MATLAB 2009a
a = rand(2000);
tic; a*a; toc
Elapsed time is 5.686150 seconds.
tic; a*a; toc
Elapsed time is 5.688004 seconds.

Mathematica 7.0
b = Table[
 RandomReal[
  UniformDistribution[{0, 1}]], 
    {2000}, {2000}];

Timing[b . b][[1]]
5.95637
System: Intel 32bit, Linux

Full SVD of a 1000x1000 Random Matrix

Sage 4.3.2
sage: m = random_matrix(RDF, 1000)
sage: %time U,s,Vh = m.SVD()
CPU times: user 2.38 s, sys: 0.08 s, total: 2.77 s
Using dgesdd.f.
MATLAB R2009a
s = 1000;
m = randn(s,s);
tic; [u,s,v] = svd(m); toc
Elapsed time is 9.666150 seconds
Using dgesvd.f.
System: Intel 32bit, Linux
Tour Quickstart · Tour Graphics · Tour Research