On Fri, 9 Apr 2021 at 13:35, Shri Keshavinee <shrikeshavi...@gmail.com> wrote: > > I'm writing a proposal on the following project "Classical Mechanics: > Efficient Equation of Motion Generation with Python". As a first step, I > would like to contribute to it by finding where the functions are getting > slower through python profiling and add this as a pull request. But I'm > confused about where to implement it. Either adding this file ( profiling > functions) in the test folder(sympy/sympy/physics/mechanics/tests/) or in > examples folder(sympy/examples/). Please guide me in choosing the path to > implement profiling.
The simplest way to profile something in Python is to make a .py file that does the thing you want to profile and then run it as: $ python -m cProfile -s cumulative myscript.py >From ipython you can also use the %prun magic command: In [1]: M = Matrix([[1, 2], [3, 4]]) In [2]: %prun -s cumulative M**2 %prun has the advantage that it profiles the operation itself rather than the whole time taken to import sympy and set up variables etc. Oscar -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxR9WL5HvDzWG8HUpQs0vHKUEOmPebUg%2B5JGRCuRH6K9SQ%40mail.gmail.com.