On Sun, Jul 1, 2012 at 1:14 AM, Joachim Durchholz <j...@durchholz.org> wrote:
> Am 01.07.2012 09:07, schrieb Ondřej Čertík:
>
>> Maybe you can figure out some way which is hash() independent and
>> still fast. At least I didn't figure it out.
>
>
> I'd try something like this:
>
> a) Yes, use native dicts as much as possible. Trying to improve over a core
> data structure that's getting unlimited love from the language team doesn't
> sound like a winning idea to me :-)

Yes, this is the main point in Python.

> b) Keep the sorted list of keys in a separate member variable.
> c) Create the sorted key list lazily (i.e. only when it's actually needed).

I am afraid it is needed pretty much all the time in the core. It would
have to be tried.

> d) Destroy the sorted list on every operation that changes the set of keys.

All SymPy types are immutable, so once you create them, the args will
never change.
So no need to free anything.

>
> This is based on the assumption that operations that need the sorted list
> are far, far rarer than operations that modify the set of keys. (Without
> that, we're in serious trouble.)

Yes, I think that's the case that you need to access the .args very often.
So the point is not to loose time sorting them.

This is at least my experience, but if you have time, please do try it out
in the sympyx code and compare the speed.

Ondrej

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

Reply via email to