Hi Richard, On Thu, Jul 23, 2015 at 3:23 AM, Richard Rondu <[email protected]> wrote: > Hi everyone. > > I'm upgrading my Qt RPN calculator app for sailfish > (https://github.com/lainwir3d/sailfish-rpn-calculator) to use sympy as an > engine. > > Everything was well and happy when I was using the sailfish emulator to test > the app, but then I decided to finally try it on my Jolla smartphone : the > import time of sympy increase to a bit above ten seconds. > > While I can manage to deal with ~5seconds, ~10seconds is a bit too much. I > was using sympy 0.7.6, I moved yesterday to the master branch hoping it > would be better but it's not.
Even 5s is unnaceptable, at least for me. > > Do any of you have any tips to decrease the import time ? I'm only using for > the moment : > > - sympy.S / N > - sympy.cos / acos / sin / asin / tan / atan > - sympy.sqrt / root / log / factorials > > I'm defining some custom constants (inheriting NumberSymbol) and some > functions (inheriting Function) but I can import them later when needed. > What I need to be quickly loaded at startup is mainly sympy.S, the others I > can load in the background. > > I tried to play a bit with __init__.py, here is the import time of each > module on the master : > > core=2373 > logic=0 > assumptions=78 > polys=5542 > series=0 > functions=1 > ntheory=2 > concrete=1307 > simplify=1 > sets=0 > solvers=0 > matrices=0 > geometry=349 > utilities=0 > integrals=0 > tensor=0 > parsing=2 > calculus=21 > plotting=177 > printing=0 > printing2=1 > printing3=0 > interactive=34 > evalf=1 > deprecated=8 > > Polys module is the one taking most of the time. Here is the import time of > its submodules : > > polytools=2009 > polyfuncs=1736 > rationaltools=0 > polyerrors=1 > numberfields=1190 > monomials=0 > orderings=0 > rootoftools=0 > polyroots=0 > domains=0 > constructor=0 > specialpolys=1 > orthopolys=0 > partfrac=467 > polyoptions=1 > rings=0 > fields=33 > > The import time is the same either with "import sympy" or "from sympy import > S" > > So, if anyone had any idea / pointers I could look at I would really > appreciate it :-) Apart from that, sympy is quite awesome ! I am really sorry it is taking so long to import, we need to fix that. I hope it is possible to fix this in Python. Thanks for posting the timings. To get to the bottom of the issue ---- is the import time slow because we are doing some (slow) calculations at import time, or is the import time slow because Python needs to read and parse ~200,000 lines of code? Once we understand where the time is actually spent, then we need to figure out a solution. Ondrej -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CADDwiVBhEgRHww2Ehrwc554Hik4-rMmOaz4_ner%2B0%3D%3Dnx%3Dy_-g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
