sage: %prun for i in [0..29]: c = sum(x[j]*(j-i) for j in [0..29])
608747 function calls (554747 primitive calls) in 0.430 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
54900/900 0.136 0.000 0.406 0.000 copy.py:145(deepcopy)
26100 0.056 0.000 0.056 0.000 {getattr}
13050 0.053 0.000 0.105 0.000 copy.py:234(_deepcopy_tuple)
54030 0.036 0.000 0.046 0.000 copy.py:267(_keep_alive)
13050 0.033 0.000 0.200 0.000 copy.py:306(_reconstruct)
13050 0.019 0.000 0.019 0.000 {method '__reduce_ex__' of 'object' objects}
121980 0.017 0.000 0.017 0.000 {method 'get' of 'dict' objects}
900 0.013 0.000 0.403 0.000 copy.py:253(_deepcopy_dict)
136830 0.010 0.000 0.010 0.000 {id}
30 0.010 0.000 0.425 0.014 {sum}
sage: %prun for i in [0..29]: c = P.sum(x[j]*(j-i) for j in [0..29])
2357 function calls in 0.024 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
930 0.017 0.000 0.017 0.000 <string>:1(<genexpr>)
30 0.003 0.000 0.020 0.001 {method 'sum' of 'sage.numerical.mip.MixedIntegerLinearProgram' objects}
62 0.002 0.000 0.002 0.000 sequence.py:86(Sequence)
31 0.001 0.000 0.004 0.000 misc.py:1319(ellipsis_range)
31 0.001 0.000 0.002 0.000 misc.py:1051(srange)
62 0.000 0.000 0.000 0.000 sequence.py:463(__init__)
372 0.000 0.000 0.000 0.000 {isinstance}
1 0.000 0.000 0.024 0.024 <string>:1(<module>)
31 0.000 0.000 0.000 0.000 {method 'range' of 'sage.rings.integer_ring.IntegerRing_class' objects}
62 0.000 0.000 0.000 0.000 {sage.structure.element.canonical_coercion}
93 0.000 0.000 0.000 0.000 {range}
62 0.000 0.000 0.000 0.000 quotient_ring.py:257(is_QuotientRing)
310 0.000 0.000 0.000 0.000 {len}
62 0.000 0.000 0.000 0.000 sequence.py:780(universe)
62 0.000 0.000 0.000 0.000 {sage.rings.polynomial.multi_polynomial_ring_generic.is_MPolynomialRing}
31 0.000 0.000 0.000 0.000 {method 'index' of 'list' objects}
31 0.000 0.000 0.000 0.000 {method 'pop' of 'list' objects}
62 0.000 0.000 0.000 0.000 {sage.structure.element.parent}
31 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}