Benchmarks - Utilities

Skip to content
Back to top
View this page
Edit this page

# Benchmarks

sage.misc.benchmark.bench0()

  Run a benchmark.

  BENCHMARK:

  Sage

      sage: from sage.misc.benchmark import *
      sage: print(bench0()[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)

  Python

      >>> from sage.all import *
      >>> from sage.misc.benchmark import *
      >>> print(bench0()[Integer(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)

sage.misc.benchmark.bench1()

  Run a benchmark.

  BENCHMARK:

  Sage

      sage: from sage.misc.benchmark import *
      sage: print(bench1()[0])
      Find the Mordell-Weil group of the elliptic curve 5077A using mwrank

  Python

      >>> from sage.all import *
      >>> from sage.misc.benchmark import *
      >>> print(bench1()[Integer(0)])
      Find the Mordell-Weil group of the elliptic curve 5077A using mwrank

sage.misc.benchmark.bench2()

  Run a benchmark.

  BENCHMARK:

  Sage

      sage: from sage.misc.benchmark import *
      sage: print(bench2()[0])
      Some basic arithmetic with very large Integer numbers: '3^1000001 * 19^100001

  Python

      >>> from sage.all import *
      >>> from sage.misc.benchmark import *
      >>> print(bench2()[Integer(0)])
      Some basic arithmetic with very large Integer numbers: '3^1000001 * 19^100001

sage.misc.benchmark.bench3()

  Run a benchmark.

  BENCHMARK:

  Sage

      sage: from sage.misc.benchmark import *
      sage: print(bench3()[0])
      Some basic arithmetic with very large Rational numbers: '(2/3)^100001 * (17/19)^100001

  Python

      >>> from sage.all import *
      >>> from sage.misc.benchmark import *
      >>> print(bench3()[Integer(0)])
      Some basic arithmetic with very large Rational numbers: '(2/3)^100001 * (17/19)^100001

sage.misc.benchmark.bench4()

  Run a benchmark.

  BENCHMARK:

  Sage

      sage: from sage.misc.benchmark import *
      sage: print(bench4()[0])
      Rational polynomial arithmetic using Sage. Compute (x^29+17*x-5)^200.

  Python

      >>> from sage.all import *
      >>> from sage.misc.benchmark import *
      >>> print(bench4()[Integer(0)])
      Rational polynomial arithmetic using Sage. Compute (x^29+17*x-5)^200.

sage.misc.benchmark.bench5()

  Run a benchmark.

  BENCHMARK:

  Sage

      sage: from sage.misc.benchmark import *
      sage: print(bench5()[0])
      Rational polynomial arithmetic using Sage. Compute (x^19 - 18*x + 1)^50 one hundred times.

  Python

      >>> from sage.all import *
      >>> from sage.misc.benchmark import *
      >>> print(bench5()[Integer(0)])
      Rational polynomial arithmetic using Sage. Compute (x^19 - 18*x + 1)^50 one hundred times.

sage.misc.benchmark.bench6()

  Run a benchmark.

  BENCHMARK:

  Sage

      sage: from sage.misc.benchmark import *
      sage: print(bench6()[0])
      Compute the p-division polynomials of y^2 = x^3 + 37*x - 997 for primes p < 40.

  Python

      >>> from sage.all import *
      >>> from sage.misc.benchmark import *
      >>> print(bench6()[Integer(0)])
      Compute the p-division polynomials of y^2 = x^3 + 37*x - 997 for primes p < 40.

sage.misc.benchmark.bench7()

  Run a benchmark.

  BENCHMARK:

  Sage

      sage: from sage.misc.benchmark import *
      sage: print(bench7()[0])
      Compute the Mordell-Weil group of y^2 = x^3 + 37*x - 997.

  Python

      >>> from sage.all import *
      >>> from sage.misc.benchmark import *
      >>> print(bench7()[Integer(0)])
      Compute the Mordell-Weil group of y^2 = x^3 + 37*x - 997.

sage.misc.benchmark.benchmark(n=-1)

  Run a well-chosen range of Sage commands and record the time it takes for each to run.

  INPUT:

  - `n` – integer (default: -1); the benchmark number; the default of -1 runs all the benchmarks

  OUTPUT:

  > list – summary of timings for each benchmark. int – if n == -1, also return the total time

  EXAMPLES:

  Sage

      sage: from sage.misc.benchmark import *
      sage: _ = benchmark()
      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: ... seconds
      Running benchmark 1
      Find the Mordell-Weil group of the elliptic curve 5077A using mwrank
      Time: ... seconds
      Running benchmark 2
      Some basic arithmetic with very large Integer numbers: '3^1000001 * 19^100001
      Time: ... seconds
      Running benchmark 3
      Some basic arithmetic with very large Rational numbers: '(2/3)^100001 * (17/19)^100001
      Time: ... seconds
      Running benchmark 4
      Rational polynomial arithmetic using Sage. Compute (x^29+17*x-5)^200.
      Time: ... seconds
      Running benchmark 5
      Rational polynomial arithmetic using Sage. Compute (x^19 - 18*x + 1)^50 one hundred times.
      Time: ... seconds
      Running benchmark 6
      Compute the p-division polynomials of y^2 = x^3 + 37*x - 997 for primes p < 40.
      Time: ... seconds
      Running benchmark 7
      Compute the Mordell-Weil group of y^2 = x^3 + 37*x - 997.
      Time: ... seconds
      Running benchmark 8

  Python

      >>> from sage.all import *
      >>> from sage.misc.benchmark import *
      >>> _ = benchmark()
      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: ... seconds
      Running benchmark 1
      Find the Mordell-Weil group of the elliptic curve 5077A using mwrank
      Time: ... seconds
      Running benchmark 2
      Some basic arithmetic with very large Integer numbers: '3^1000001 * 19^100001
      Time: ... seconds
      Running benchmark 3
      Some basic arithmetic with very large Rational numbers: '(2/3)^100001 * (17/19)^100001
      Time: ... seconds
      Running benchmark 4
      Rational polynomial arithmetic using Sage. Compute (x^29+17*x-5)^200.
      Time: ... seconds
      Running benchmark 5
      Rational polynomial arithmetic using Sage. Compute (x^19 - 18*x + 1)^50 one hundred times.
      Time: ... seconds
      Running benchmark 6
      Compute the p-division polynomials of y^2 = x^3 + 37*x - 997 for primes p < 40.
      Time: ... seconds
      Running benchmark 7
      Compute the Mordell-Weil group of y^2 = x^3 + 37*x - 997.
      Time: ... seconds
      Running benchmark 8