Am 03.10.2012 18:11, schrieb Ondřej Čertík:
I would point out, that the in my experience, it's quite slow to import
things inside a function,

I can imagine. The import will run on every call to the function, and that's always slower than simply looking up the imported name in the dictionary of the class object.

> which might or might not be a problem, depending
on the situation.

It's probably proportional to the number of calls to the function.

> I don't know at the moment, how C.something is doing
performance wise.

It's a call to a Python function that does a dictionary lookup.
I suspect it's slower than a direct call but faster than an import inside the function.

That's a very vague estimate and probably not worth the bits needed to store it. For performance, there's another aspect: all the usually-used workarounds for circular dependency problems will get some attention by whoever is tuning Python for performance. Atypical stuff like C won't get this love, so even if it's fast now, it will fall back behind the more typical techniques as Python improves. So while I wouldn't disregard benchmarking results, looking at how Python is being used in the wild is as important.

BTW I counted around 890 call sites to C.
That's not too bad. Changing the calls to raises() wasn't much different.

--
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to