SimPy (http://simpy.sf.net) is a very nice discrete event simulation package written in Python. It is, however, rather slow for large models and I'm looking at ways to speed it up. SimPy should be a good test case for PyPy and when the JIT stabilizes, PyPy may provide faster execution times. As we'd like to see some immediate benefits, I've tried Psyco which provides a worthwhile 45% improvement on one model and I'll look at modifying SimPy to work better with it. SimPy makes heavy use of generators, so I'm interested in the support for them planned for the next release. How close is Psyco generator support to being useful? Greenlets look like they could be a viable alternative to generators for simulating concurrency. How expensive are greenlets compared to generators? Regards, Steve
On Mon, Mar 16, 2009 at 10:36 PM, Steven H. Rogers <steve@shrogers.com> wrote:
Greenlets look like they could be a viable alternative to generators for simulating concurrency. How expensive are greenlets compared to generators?
I haven't heard of anyone who has benchmarked the difference. I'd be interested in seeing some results myself. I could handwave based on indirect reports, for what it's worth, as it's easier than actually benchmarking it myself :-) The Concurrence framework supports running on top of greenlets and on top of Stackless Python, which greenlets are a spin off of. It claims that there's only a 10-25% difference in performance in Stackless' favour [1]. Stackless Python and a generator based solution were compared in a recent benchmark [2] with generators being around 10 times slower than Stackless. Given that both reports are more or less accurate, I expect greenlets to be considerably faster than generators. Cheers, Richard. [1] http://opensource.hyves.org/concurrence/index.html [2] http://entitycrisis.blogspot.com/2009/03/concurrent-scaling-benchmarks.html
Richard Tew wrote:
On Mon, Mar 16, 2009 at 10:36 PM, Steven H. Rogers <steve@shrogers.com> wrote:
Greenlets look like they could be a viable alternative to generators for simulating concurrency. How expensive are greenlets compared to generators?
I haven't heard of anyone who has benchmarked the difference. I'd be interested in seeing some results myself.
I could handwave based on indirect reports, for what it's worth, as it's easier than actually benchmarking it myself :-) ...
Thanks Richard. A little hand waving from someone with your experience provides good insight. I'll start work on some benchmarks. Does anyone know how well greenlets and Psyco play together? Regards, Steve
participants (2)
-
Richard Tew -
Steven H. Rogers