Discussion:
C version of functools.lru_cache
Peter Brady
2014-06-26 15:38:50 UTC
Permalink
Hello python devs,

I was recently in need of some faster caching and thought this would be a
good opportunity to familiarize myself with the Python/C api so I wrote a C
extension for the lru_cache in functools. The source is at
https://github.com/pbrady/fastcache.git and I've posted it as a package on
PyPI (fastcache). There are some simple benchmarks on the github page
showing about 9x speedup. I would like to submit this for incorporation
into the standard library. Is there any interest in this? I suspect it
probably requires some changes/cleanup especially since I haven't addressed
thread-safety at all.

Thanks,
Peter.

P.S. This was the motivation for the faster caching
https://github.com/sympy/sympy/pull/7464.
Benjamin Peterson
2014-06-26 16:33:29 UTC
Permalink
You might look at https://bugs.python.org/issue14373
Post by Peter Brady
Hello python devs,
I was recently in need of some faster caching and thought this would be a
good opportunity to familiarize myself with the Python/C api so I wrote a C
extension for the lru_cache in functools. The source is at
https://github.com/pbrady/fastcache.git and I've posted it as a package on
PyPI (fastcache). There are some simple benchmarks on the github page
showing about 9x speedup. I would like to submit this for incorporation
into the standard library. Is there any interest in this? I suspect it
probably requires some changes/cleanup especially since I haven't addressed
thread-safety at all.
Thanks,
Peter.
P.S. This was the motivation for the faster caching
https://github.com/sympy/sympy/pull/7464.
_______________________________________________
Python-Dev mailing list
https://mail.python.org/mailman/listinfo/python-dev
https://mail.python.org/mailman/options/python-dev/benjamin%40python.org
Peter Brady
2014-06-26 17:23:06 UTC
Permalink
Looks like it's already in the works! Nevermind
Post by Benjamin Peterson
You might look at https://bugs.python.org/issue14373
Post by Peter Brady
Hello python devs,
I was recently in need of some faster caching and thought this would be a
good opportunity to familiarize myself with the Python/C api so I wrote a C
extension for the lru_cache in functools. The source is at
https://github.com/pbrady/fastcache.git and I've posted it as a package on
PyPI (fastcache). There are some simple benchmarks on the github page
showing about 9x speedup. I would like to submit this for incorporation
into the standard library. Is there any interest in this? I suspect it
probably requires some changes/cleanup especially since I haven't addressed
thread-safety at all.
Thanks,
Peter.
P.S. This was the motivation for the faster caching
https://github.com/sympy/sympy/pull/7464.
_______________________________________________
Python-Dev mailing list
https://mail.python.org/mailman/listinfo/python-dev
https://mail.python.org/mailman/options/python-dev/benjamin%40python.org
Loading...