@slelievre I compiled sagemath using march=native -O3 -fno-plt
and unfortunatlely I have to say that sage is now slower (I think). The thing you have to know is, sagemath speeds up if I use schedutil
as my scaling governor. Unfortunately I can't remember whether I was using schedutil
or powersave
when I was testing the binary version (probably powersave
though). So I downloaded the binary version again (turns out out you can have both installed side-by-side)(it's kind of creepy that the binary version remembers my previous inputs). Here are results from old the binary version:
Running benchmark 0 Benchmark 0:
Factor the following polynomial over
the rational numbers: (x^97+19*x+1)*(x^103-19*x^97+14)*(x^100-1) Time: 0.2822810000000002 seconds
Running benchmark 1 Find the
Mordell-Weil group of the elliptic
curve 5077A using mwrank Time:
0.4469660000000002 seconds Running benchmark 2 Some basic arithmetic
with very large Integer numbers:
'3^1000001 * 19^100001 Time:
0.01994899999999955 seconds Running benchmark 3 Some basic arithmetic
with very large Rational numbers:
'(2/3)^100001 * (17/19)^100001 Time:
0.028340999999999728 seconds Running benchmark 4 Rational polynomial
arithmetic using Sage. Compute
(x^29+17*x-5)^200. Time:
0.009201000000000015 seconds Running benchmark 5 Rational polynomial
arithmetic using Sage. Compute (x^19
- 18*x + 1)^50 one hundred times. Time: 0.10662800000000017 seconds
Running benchmark 6 Compute the
p-division polynomials of y^2 = x^3 +
37*x - 997 for primes p < 40. Time:
0.05905899999999997 seconds Running benchmark 7 Compute the Mordell-Weil
group of y^2 = x^3 + 37*x - 997.
Time: 0.37592800000000004 seconds
Running benchmark 8 %time
sum(1/(x^2), x,1,100000) CPU times:
user 1min 11s, sys: 1.14 s, total:
1min 12s
Wall time: 27.9 s
Here are results from the new binary version (powersave):
Running benchmark 0
Benchmark 0: Factor the following polynomial over
the rational numbers: (x^97+19*x+1)*(x^103-19*x^97+14)*(x^100-1)
Time: 0.2790720000000002 seconds
Running benchmark 1
Find the Mordell-Weil group of the elliptic curve 5077A using mwrank
Time: 0.4314460000000002 seconds
Running benchmark 2
Some basic arithmetic with very large Integer numbers: '3^1000001 * 19^100001
Time: 0.019366999999999912 seconds
Running benchmark 3
Some basic arithmetic with very large Rational numbers: '(2/3)^100001 * (17/19)^100001
Time: 0.028370000000000672 seconds
Running benchmark 4
Rational polynomial arithmetic using Sage. Compute (x^29+17*x-5)^200.
Time: 0.008942000000000228 seconds
Running benchmark 5
Rational polynomial arithmetic using Sage. Compute (x^19 - 18*x + 1)^50 one hundred times.
Time: 0.106522 seconds
Running benchmark 6
Compute the p-division polynomials of y^2 = x^3 + 37*x - 997 for primes p < 40.
Time: 0.05832100000000029 seconds
Running benchmark 7
Compute the Mordell-Weil group of y^2 = x^3 + 37*x - 997.
Time: 0.3272319999999995 seconds
Running benchmark 8
From compiled version (powersave):
Running benchmark 0
Benchmark 0: Factor the following polynomial over
the rational numbers: (x^97+19*x+1)*(x^103-19*x^97+14)*(x^100-1)
Time: 0.3547199999999995 seconds
Running benchmark 1
Find the Mordell-Weil group of the elliptic curve 5077A using mwrank
Time: 0.43139200000000066 seconds
Running benchmark 2
Some basic arithmetic with very large Integer numbers: '3^1000001 * 19^100001
Time: 0.019306000000000267 seconds
Running benchmark 3
Some basic arithmetic with very large Rational numbers: '(2/3)^100001 * (17/19)^100001
Time: 0.028086999999999307 seconds
Running benchmark 4
Rational polynomial arithmetic using Sage. Compute (x^29+17*x-5)^200.
Time: 0.008855999999999753 seconds
Running benchmark 5
Rational polynomial arithmetic using Sage. Compute (x^19 - 18*x + 1)^50 one hundred times.
Time: 0.10795900000000103 seconds
Running benchmark 6
Compute the p-division polynomials of y^2 = x^3 + 37*x - 997 for primes p < 40.
Time: 4.499999999918458e-05 seconds
Running benchmark 7
Compute the Mordell-Weil group of y^2 = x^3 + 37*x - 997.
Time: 2.1000000000270802e-05 seconds
Running benchmark 8
What's interesting is that the compiled version is slower in benchmark 0. Could this be due to a missing dependency or something? Also the compiled version is faster at benchmarks 7 and 8. Now for my own test: the time it takes to compute sum(1/(x^2), x,1,100000)
:
Binary version (powersave):
CPU times: user 1min 11s, sys: 1.1 s, total: 1min 12s
Wall time: 27.4 s
Compiled version (powersave):
CPU times: user 1min 23s, sys: 1.3 s, total: 1min 25s
Wall time: 28.5 s
So the compiled version is slower in this regard.
Binary version (schedutil):
Running benchmark 0
Benchmark 0: Factor the following polynomial over
the rational numbers: (x^97+19*x+1)*(x^103-19*x^97+14)*(x^100-1)
Time: 0.14427600000000007 seconds
Running benchmark 1
Find the Mordell-Weil group of the elliptic curve 5077A using mwrank
Time: 0.1471680000000002 seconds
Running benchmark 2
Some basic arithmetic with very large Integer numbers: '3^1000001 * 19^100001
Time: 0.0064669999999997785 seconds
Running benchmark 3
Some basic arithmetic with very large Rational numbers: '(2/3)^100001 * (17/19)^100001
Time: 0.009400999999999993 seconds
Running benchmark 4
Rational polynomial arithmetic using Sage. Compute (x^29+17*x-5)^200.
Time: 0.00301399999999985 seconds
Running benchmark 5
Rational polynomial arithmetic using Sage. Compute (x^19 - 18*x + 1)^50 one hundred times.
Time: 0.03593299999999999 seconds
Running benchmark 6
Compute the p-division polynomials of y^2 = x^3 + 37*x - 997 for primes p < 40.
Time: 3.0999999999892225e-05 seconds
Running benchmark 7
Compute the Mordell-Weil group of y^2 = x^3 + 37*x - 997.
Time: 1.2999999999596668e-05 seconds
Running benchmark 8
Compiled version (schedutil):
Running benchmark 0
Benchmark 0: Factor the following polynomial over
the rational numbers: (x^97+19*x+1)*(x^103-19*x^97+14)*(x^100-1)
Time: 0.17197400000000007 seconds
Running benchmark 1
Find the Mordell-Weil group of the elliptic curve 5077A using mwrank
Time: 0.14492799999999972 seconds
Running benchmark 2
Some basic arithmetic with very large Integer numbers: '3^1000001 * 19^100001
Time: 0.006648000000000209 seconds
Running benchmark 3
Some basic arithmetic with very large Rational numbers: '(2/3)^100001 * (17/19)^100001
Time: 0.009484000000000048 seconds
Running benchmark 4
Rational polynomial arithmetic using Sage. Compute (x^29+17*x-5)^200.
Time: 0.0030330000000002855 seconds
Running benchmark 5
Rational polynomial arithmetic using Sage. Compute (x^19 - 18*x + 1)^50 one hundred times.
Time: 0.0348070000000007 seconds
Running benchmark 6
Compute the p-division polynomials of y^2 = x^3 + 37*x - 997 for primes p < 40.
Time: 5.2999999999858716e-05 seconds
Running benchmark 7
Compute the Mordell-Weil group of y^2 = x^3 + 37*x - 997.
Time: 1.1999999999900979e-05 seconds
Running benchmark 8
My own tests:
Binary version (schedutil):
CPU times: user 40.2 s, sys: 547 ms, total: 40.8 s
Wall time: 12.1 s
Compiled version (schedutil):
CPU times: user 46.3 s, sys: 621 ms, total: 46.9 s
Wall time: 12.6 s
P.S. I didn't delete the .sage directory before compiling.
Not expert enough to post an answer, and in particular I cannot answer your question about flags, but I would tend to think Sage can only be faster if you build it from source.
If you care about speed, the best way to find out is probably to try it. If you do, please keep us posted with the result!
You could even try several methods of installing and report comparing startup time and any other speed benchmarks you have:
On a 2014 MacBook Air, with Sage latest develop compiled from source, I get
Do you have sufficient RAM? Do you use swap? Do you have enough disk space?