Development Tips : Profiler Output - sympy/sympy GitHub Wiki

This page lists the results of running SymPy's unit tests with cProfile. It might be useful for eliminating bottlenecks.

With caching enabled

Total time

Total time (excluding subcalls), t > 1 shown.

20088743             50.955     0.000      50.957     0.000      {isinstance}
96807/94799          32.788     0.000      98.988     0.001      mul.py:8(flatten)
3447927/3447134      22.638     0.000      46.705     0.000      basic.py:193(sympify)
1055757/695354       20.587     0.000      57.501     0.000      basic_methods.py:394(compare)
593995               19.217     0.000      55.967     0.000      assumptions.py:179(assume)
4380253/4133305      16.076     0.000      21.712     0.000      basic_methods.py:277(__hash__)
6618919              14.897     0.000      14.897     0.000      basic_methods.py:215(__getattr__)
1654915/1443663      14.171     0.000      30.896     0.000      basic_methods.py:262(__getattr__)
982775/331303        12.947     0.000      335.521    0.001      basic_methods.py:111(wrapper)
857433/776697        12.812     0.000      40.272     0.000      basic.py:121(wrapper)
1984206              12.437     0.000      17.349     0.000      basic_methods.py:271(__setattr__)
1654915/1443663      11.740     0.000      18.251     0.000      assumptions.py:129(_get_assumption)
576328               8.638      0.000      72.016     0.000      basic.py:186(__new__)
373203               7.261      0.000      17.866     0.000      basic_methods.py:221(__cmp__)
21737/21736          7.255      0.000      49.021     0.002      add.py:10(flatten)
997815/988100        6.621      0.000      20.185     0.000      {getattr}
155931               6.454      0.000      11.864     0.000      decimal.py:516(__new__)
3331921/3331664      6.227      0.000      6.228      0.000      {len}
2469042/1732880      6.103      0.000      23.275     0.000      {cmp}
403005/403004        6.040      0.000      63.260     0.000      methods.py:115(__eq__)
416755               5.409      0.000      53.404     0.000      relational.py:17(__new__)
229385/212693        5.359      0.000      37.457     0.000      numbers.py:451(__mul__)
571224               5.234      0.000      7.564      0.000      assumptions.py:167(_change_assumption)
2032776              5.014      0.000      5.014      0.000      {method 'startswith' of 'str' objects}
403022               4.940      0.000      43.091     0.000      relational.py:54(__nonzero__)
124264/77110         3.802      0.000      23.620     0.000      basic.py:410(has)
106495/104838        3.746      0.000      15.388     0.000      numbers.py:464(__add__)
1897746              3.740      0.000      3.740      0.000      {method 'items' of 'dict' objects}
356515/297584        3.698      0.000      21.835     0.000      {map}
511471               3.644      0.000      10.042     0.000      float_.py:79(normalize)
1544693              3.515      0.000      4.041      0.000      {method 'has_key' of 'dict' objects}
142838/120750        3.314      0.000      164.623    0.001      operations.py:13(__new__)
359127               3.200      0.000      7.234      0.000      symbol.py:51(_hashable_content)
177702               3.191      0.000      5.842      0.000      power.py:213(as_base_exp)
1433307              3.033      0.000      3.494      0.000      {method 'get' of 'dict' objects}
1258409              2.932      0.000      2.932      0.000      {built-in method __new__ of type object at 0x1E1E6DD0}
508016               2.882      0.000      4.450      0.000      utils_.py:5(bitcount)
302941               2.854      0.000      3.718      0.000      basic.py:1287(__new__)
755007/678245        2.710      0.000      21.588     0.000      {method 'index' of 'list' objects}
153492/149676        2.652      0.000      23.578     0.000      methods.py:53(__pow__)
39183/19641          2.610      0.000      61.485     0.003      mul.py:298(_eval_expand_basic)
12057                2.588      0.000      7.042      0.001      decimal.py:1186(_divide)
656894               2.218      0.000      2.218      0.000      basic_methods.py:286(_hashable_content)
41033/26443          2.196      0.000      27.667     0.001      power.py:245(_eval_expand_basic)
331660               2.131      0.000      10.033     0.000      float_.py:108(makefloat)
84206/79679          2.118      0.000      67.146     0.001      methods.py:40(__mul__)
310460/97159         2.079      0.000      4.598      0.000      basic_methods.py:77(mycopy)
99612/81676          1.893      0.000      4.342      0.000      matrices.py:127(__getitem__)
65497                1.823      0.000      13.146     0.000      numbers.py:531(__eq__)
179018               1.806      0.000      5.630      0.000      float_.py:299(__new__)
488146/488145        1.775      0.000      3.538      0.000      {hasattr}
590324               1.746      0.000      1.746      0.000      {zip}
542421               1.672      0.000      1.672      0.000      basic.py:323(args)
529159               1.628      0.000      1.995      0.000      {math.log}
345377/345347        1.604      0.000      23.452     0.000      {method 'sort' of 'list' objects}
521416               1.544      0.000      1.544      0.000      power.py:64(base)
37314/36990          1.534      0.000      8.998      0.000      basic.py:530(matches)
8687/4664            1.473      0.000      125.643    0.027      order.py:83(__new__)
678952               1.441      0.000      1.441      0.000      {method 'pop' of 'list' objects}
57559/56108          1.399      0.000      40.121     0.001      methods.py:69(__div__)
120423               1.398      0.000      1.583      0.000      decimal.py:2875(__init__)
3829                 1.387      0.000      2.778      0.001      transformer.py:105(__init__)
41715/25859          1.378      0.000      4.536      0.000      simplify.py:122(separate)
131861               1.369      0.000      2.019      0.000      assumptions.py:302(_assume_hashable_content)
22055/19795          1.335      0.000      73.301     0.004      mul.py:461(_eval_subs)
666919               1.333      0.000      1.333      0.000      {method 'append' of 'list' objects}
416904               1.291      0.000      1.291      0.000      relational.py:28(lhs)
264409               1.256      0.000      1.256      0.000      float_.py:40(rshift)
97481/78950          1.215      0.000      86.530     0.001      basic_methods.py:90(wrapper)
642478               1.214      0.000      1.214      0.000      basic.py:105(<lambda>)
102135/21755         1.214      0.000      87.128     0.004      basic.py:379(subs)
23563/7407           1.207      0.000      57.416     0.008      operations.py:56(_matches_commutative)
416823               1.201      0.000      1.201      0.000      relational.py:32(rhs)
128894/39336         1.195      0.000      86.698     0.002      basic.py:733(expand)
152267/148341        1.162      0.000      6.756      0.000      float_.py:580(__mul__)
203748               1.147      0.000      1.147      0.000      base.py:163(__getattribute__)
129530/113341        1.147      0.000      5.221      0.000      float_.py:545(__add__)
6                    1.124      0.187      1.530      0.255      __init__.py:2(<module>)
160475               1.120      0.000      1.120      0.000      utils_.py:17(trailing_zeros)
90809/15329          1.068      0.000      14.958     0.001      basic.py:719(_eval_expand_trig)
144274               1.006      0.000      1.545      0.000      matrices.py:80(key2ij)

Cumulative time

Cumulative time (including subcalls), t > 10 shown.

1                    0.000      0.000      507.191    507.191    cmdline.py:7(main)
1                    0.000      0.000      507.067    507.067    session.py:55(main)
797/1                0.022      0.000      507.008    507.008    session.py:71(runtraced)
797/1                0.022      0.000      507.008    507.008    session.py:101(run)
652                  0.008      0.000      500.562    0.768      item.py:64(run)
652                  0.006      0.000      500.459    0.768      item.py:69(execute)
982775/331303        12.947     0.000      335.521    0.001      basic_methods.py:111(wrapper)
142838/120750        3.314      0.000      164.623    0.001      operations.py:13(__new__)
6844/686             0.411      0.000      157.411    0.229      basic.py:1088(oseries)
8687/4664            1.473      0.000      125.643    0.027      order.py:83(__new__)
48/47                0.142      0.003      113.397    2.413      risch.py:83(heurisch)
10602/6348           0.355      0.000      108.909    0.017      order.py:290(contains)
6146/165             0.031      0.000      105.287    0.638      limits.py:117(<lambda>)
1122/233             0.033      0.000      104.237    0.447      limits.py:393(mrv_leadterm)
96807/94799          32.788     0.000      98.988     0.001      mul.py:8(flatten)
1960/780             0.083      0.000      98.723     0.127      mul.py:480(_eval_oseries)
482/238              0.009      0.000      90.317     0.379      limits.py:305(limitinf)
102135/21755         1.214      0.000      87.128     0.004      basic.py:379(subs)
128894/39336         1.195      0.000      86.698     0.002      basic.py:733(expand)
97481/78950          1.215      0.000      86.530     0.001      basic_methods.py:90(wrapper)
9196/8484            0.313      0.000      83.328     0.010      order.py:192(_get_cache_index)
395                  0.021      0.000      81.985     0.208      limits.py:335(calculate_series)
51                   0.020      0.000      75.476     1.480      risch.py:269(integrate)
22055/19795          1.335      0.000      73.301     0.004      mul.py:461(_eval_subs)
576328               8.638      0.000      72.016     0.000      basic.py:186(__new__)
392/339              0.056      0.000      71.603     0.211      basic.py:1143(_compute_oseries)
1795                 0.090      0.000      68.094     0.038      simplify.py:994(simplify)
84206/79679          2.118      0.000      67.146     0.001      methods.py:40(__mul__)
78                   0.002      0.000      63.895     0.819      limits.py:476(limit)
1240/1008            0.060      0.000      63.456     0.063      power.py:432(_eval_oseries)
403005/403004        6.040      0.000      63.260     0.000      methods.py:115(__eq__)
39183/19641          2.610      0.000      61.485     0.003      mul.py:298(_eval_expand_basic)
4043/3340            0.053      0.000      59.574     0.018      basic.py:1176(limit)
1786/1385            0.150      0.000      59.077     0.043      limits_series.py:19(__new__)
7404                 0.073      0.000      57.681     0.008      basic.py:608(match)
1055757/695354       20.587     0.000      57.501     0.000      basic_methods.py:394(compare)
23563/7407           1.207      0.000      57.416     0.008      operations.py:56(_matches_commutative)
1165/1046            0.056      0.000      57.300     0.055      add.py:276(extract_leading_order)
79                   0.003      0.000      56.387     0.714      basic.py:1065(series)
593995               19.217     0.000      55.967     0.000      assumptions.py:179(assume)
1330/845             0.179      0.000      55.292     0.065      limits_series.py:83(__new__)
416755               5.409      0.000      53.404     0.000      relational.py:17(__new__)
9917/3438            0.250      0.000      52.353     0.015      basic.py:1187(as_leading_term)
687/360              0.095      0.000      51.650     0.143      limits_series.py:140(mrv_inflimit)
7056/6653            0.153      0.000      51.442     0.008      order.py:228(find_limit)
20088743             50.955     0.000      50.957     0.000      {isinstance}
21737/21736          7.255      0.000      49.021     0.002      add.py:10(flatten)
1142/892             0.026      0.000      48.658     0.055      add.py:273(_eval_oseries)
3447927/3447134      22.638     0.000      46.705     0.000      basic.py:193(sympify)
17666/9398           0.319      0.000      45.182     0.005      mul.py:332(matches)
403022               4.940      0.000      43.091     0.000      relational.py:54(__nonzero__)
1795                 0.174      0.000      42.998     0.024      simplify.py:786(radsimp)
163803/74959         0.887      0.000      40.535     0.001      basic.py:695(_eval_expand_basic)
512/461              0.041      0.000      40.477     0.088      add.py:295(_eval_as_leading_term)
857433/776697        12.812     0.000      40.272     0.000      basic.py:121(wrapper)
57559/56108          1.399      0.000      40.121     0.001      methods.py:69(__div__)
70                   0.036      0.001      39.180     0.560      solvers.py:19(solve)
9575                 0.264      0.000      38.333     0.004      base.py:104(__new__)
229385/212693        5.359      0.000      37.457     0.000      numbers.py:451(__mul__)
801                  0.107      0.000      37.236     0.046      div_.py:5(div)
4700/4256            0.246      0.000      36.171     0.008      add.py:256(_eval_subs)
223                  0.003      0.000      32.355     0.145      wrapper.py:9(div)
55                   0.001      0.000      31.578     0.574      pytest.py:80(func_wrapper)
1654915/1443663      14.171     0.000      30.896     0.000      basic_methods.py:262(__getattr__)
1                    0.000      0.000      30.812     30.812     test_recurr.py:18(test_rsolve_ratio)
1                    0.001      0.001      30.769     30.769     recurr.py:298(rsolve_ratio)
2898/194             0.068      0.000      30.109     0.155      limits.py:173(mrv)
196                  0.001      0.000      28.966     0.148      wrapper.py:23(quo)
41033/26443          2.196      0.000      27.667     0.001      power.py:245(_eval_expand_basic)
59                   0.160      0.003      27.557     0.467      solvers.py:114(solve_linear_system)
18                   0.001      0.000      25.789     1.433      quad.py:321(nintegrate)
17141/16510          0.725      0.000      25.574     0.002      power.py:198(_eval_subs)
56                   0.002      0.000      24.142     0.431      integrals.py:86(doit)
52                   0.001      0.000      24.117     0.464      integrals.py:234(integrate)
1372                 0.026      0.000      23.943     0.017      quad.py:52(__call__)
7584/6991            0.140      0.000      23.851     0.003      function.py:79(__new__)
1                    0.000      0.000      23.788     23.788     test_risch.py:76(test_heurisch_radicals)
60/58                0.004      0.000      23.759     0.410      integrals.py:120(_eval_integral)
124264/77110         3.802      0.000      23.620     0.000      basic.py:410(has)
153492/149676        2.652      0.000      23.578     0.000      methods.py:53(__pow__)
345377/345347        1.604      0.000      23.452     0.000      {method 'sort' of 'list' objects}
2469042/1732880      6.103      0.000      23.275     0.000      {cmp}
1365/13              0.029      0.000      22.874     1.760      quad.py:64(adaptive)
32975/9352           0.211      0.000      22.173     0.002      basic.py:1050(evalf)
1365                 0.018      0.000      22.146     0.016      quad.py:178(_eval)
2730                 0.348      0.000      22.031     0.008      quad.py:160(_eval)
356515/297584        3.698      0.000      21.835     0.000      {map}
401                  0.013      0.000      21.833     0.054      basic.py:484(subs_dict)
1                    0.001      0.001      21.816     21.816     test_geometry.py:249(test_polygon)
4380253/4133305      16.076     0.000      21.712     0.000      basic_methods.py:277(__hash__)
755007/678245        2.710      0.000      21.588     0.000      {method 'index' of 'list' objects}
29944                0.431      0.000      20.258     0.001      quad.py:48(g)
997815/988100        6.621      0.000      20.185     0.000      {getattr}
1                    0.000      0.000      19.998     19.998     test_risch.py:52(test_heurisch_trigonometric)
1654915/1443663      11.740     0.000      18.251     0.000      assumptions.py:129(_get_assumption)
1                    0.000      0.000      18.189     18.189     test_series.py:251(test_issue159)
1                    0.001      0.001      18.076     18.076     test_geometry.py:58(test_line)
373203               7.261      0.000      17.866     0.000      basic_methods.py:221(__cmp__)
3926                 0.169      0.000      17.642     0.004      basic.py:816(as_coefficient)
1984206              12.437     0.000      17.349     0.000      basic_methods.py:271(__setattr__)
53645                0.424      0.000      16.866     0.000      basic.py:374(_eval_subs)
6863/5137            0.122      0.000      16.032     0.003      basic.py:1039(_seq_eval_evalf)
21694/18717          0.650      0.000      15.774     0.001      power.py:51(__new__)
8839/8793            0.142      0.000      15.694     0.002      function.py:183(_eval_evalf)
106495/104838        3.746      0.000      15.388     0.000      numbers.py:464(__add__)
53/50                0.000      0.000      15.191     0.304      entity.py:21(do_intersection)
57/56                0.015      0.000      15.094     0.270      line.py:206(intersection)
75/69                0.002      0.000      15.081     0.219      limits.py:163(compare)
19881/19880          0.344      0.000      14.983     0.001      methods.py:20(__add__)
90809/15329          1.068      0.000      14.958     0.001      basic.py:719(_eval_expand_trig)
6618919              14.897     0.000      14.897     0.000      basic_methods.py:215(__getattr__)
1                    0.001      0.001      14.504     14.504     test_demidovich.py:90(test_f1b)
5271/5263            0.045      0.000      14.485     0.003      function.py:322(_eval_apply_evalf)
235                  0.007      0.000      14.413     0.061      point.py:197(__add__)
1                    0.000      0.000      14.014     14.014     test_quad.py:7(test_nintegrate)
92                   0.005      0.000      13.828     0.150      line.py:356(__contains__)
401/325              0.039      0.000      13.487     0.041      limits.py:227(rewrite)
65497                1.823      0.000      13.146     0.000      numbers.py:531(__eq__)
1989                 0.016      0.000      13.071     0.007      simplify.py:179(together)
401                  0.023      0.000      12.883     0.032      limits_series.py:301(rewrite_expr)
3439/2745            0.081      0.000      12.808     0.005      mul.py:275(_expandsums)
206                  0.002      0.000      12.755     0.062      point.py:211(__sub__)
1                    0.001      0.001      12.107     12.107     test_geometry.py:168(test_ellipse)
1                    0.000      0.000      12.069     12.069     test_limit.py:146(test_mrv_leadterm2)
155931               6.454      0.000      11.864     0.000      decimal.py:516(__new__)
18974                0.104      0.000      11.673     0.001      mul.py:311(<genexpr>)
1                    0.000      0.000      11.605     11.605     test_risch.py:95(test_issue510)
10046/953            0.283      0.000      11.351     0.012      function.py:401(__new__)
9669/904             0.335      0.000      11.265     0.012      basic.py:997(diff)
3059/2567            0.293      0.000      11.197     0.004      simplify.py:345(collect)
1                    0.000      0.000      10.841     10.841     test_demidovich.py:22(test_Limits_simple_0)
4017                 0.049      0.000      10.739     0.003      add.py:128(_matches_simple)
10370/1989           0.672      0.000      10.703     0.005      simplify.py:231(_together)
4479                 0.181      0.000      10.453     0.002      base.py:830(coefficients2sympy)
39322                0.538      0.000      10.222     0.000      methods.py:30(__sub__)
7390                 0.433      0.000      10.193     0.001      simplify.py:10(fraction)
1                    0.000      0.000      10.155     10.155     test_quad.py:19(test_nintegrate_infinite)
807                  0.039      0.000      10.096     0.013      basic.py:1206(as_coeff_exponent)
511471               3.644      0.000      10.042     0.000      float_.py:79(normalize)
331660               2.131      0.000      10.033     0.000      float_.py:108(makefloat)
17551/17550          0.322      0.000      10.016     0.001      methods.py:16(__neg__)

Category:Documentation Category:cProfile

⚠️ **GitHub.com Fallback** ⚠️