Comment #14 on issue 3427 by [email protected]: sympy imports matplotlib on start-up
http://code.google.com/p/sympy/issues/detail?id=3427

If you import SymPy in a clean environment (i.e., a virtualenv or something similar), and compare it against your normal environment, you can see how much of the time is spent importing other stuff. Matplotlib, Numpy, gmpy, and possibly other things are all imported when SymPy is, although ideally they wouldn't be.

It would be great to profile it. Try using CProfilier, and, if you can figure out how to do it, line_profiler. Optimizing this is hard. It's a microoptimization compared to what you usually do, and furthermore, it might just be a bunch of little things adding up. For example, all statements at the class level are run at class definition time (i.e., import time). So something like

class A:
    p = something

will be slow if something takes a while to compute (and if something builds up a SymPy expression, that might be the case).

class A:
    @property
    def p(self):
        return something

would be faster (but it's harder to read, and it might not be faster if something doesn't require computation, like None).

We could also play with deferred importing, but I doubt it would get us anywhere, because the modules are so interdependent.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to