Thanks for trying that out.  I had never heard of pympler before.  The
current caching mechanism is based on hashing.  By my tests,
'pympler.asizeof' is 500-1000x slower than hashing.  That's a strong
deficit for cachey to overcome (as far as sympy objects are concerned).

In [1]: import sympy

In [2]: from sympy.abc import a, b, c, d, e, x, y

In [3]: from pympler.asizeof import asizeof

In [4]: y=a*x**3+b*x**2+c*x+d

In [5]: y1, y2, y3 = sympy.solve(y, x, check=False)

In [6]: %time asizeof(y1)
CPU times: user 9.63 ms, sys: 0 ns, total: 9.63 ms
Wall time: 9.56 ms
Out[6]: 52608

In [7]: %time hash(y1)
CPU times: user 14 µs, sys: 1 µs, total: 15 µs
Wall time: 19.8 µs
Out[7]: 5743556980832125790

In [8]: y=a*x**4+b*x**3+c*x**2+d*x+e

In [9]: y1,y2,y3,y4=sympy.solve(y,x,check=False)

In [10]: %time asizeof(y4)
CPU times: user 16.7 ms, sys: 2.05 ms, total: 18.8 ms
Wall time: 18.6 ms
Out[10]: 85208

In [11]: %time hash(y4)
CPU times: user 14 µs, sys: 1 µs, total: 15 µs
Wall time: 19.8 µs
Out[11]: 4388441583750016728


On Mon, Aug 24, 2015 at 10:49 PM, Denis Akhiyarov <denis.akhiya...@gmail.com
> wrote:

> It looks like pympler works pretty well on sympy symbols, here is my
> notebook:
>
> https://gist.github.com/denfromufa/4d0e6a94f70fac155b66
>
>
> On Monday, August 24, 2015 at 10:03:30 PM UTC-5, Denis Akhiyarov wrote:
>>
>> Nbytes is very hard in Python, and getsizeof() does not work very well.
>> People has addressed this using github.com/pympler.
>> Not sure if anyone tried it on sympy objects and how costly is that
>> calculation. Cachey has very simple nbytes calculation, mainly intended for
>> numpy and pandas objects.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sympy" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sympy/slKi02rzXVE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> 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/6e7f1a64-e8b9-46b9-9dd8-28f18de3a416%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/6e7f1a64-e8b9-46b9-9dd8-28f18de3a416%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to sympy@googlegroups.com.
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/CALoNiQfemyyeGWLfRWaCw44kZ8wLvF6ai5BeUWQ7Fi%3DZV4k9fg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to