Hi everyone. I have a cellular automata framework in C++ and I use cython
and cpython to run it. I found out that if I port it to pure python and run
it with pypy, it's close to the same performance as the C++ version. (about
2x as slow, compared to 20x as slow when using pure python + cpython). When
I throw in other overheads with pure python libraries, using the pure
python and pypy is much faster than cpython with the C++ library, all
things equal.

What I'd like to do is detect if pypy or cpython is doing the importing of
my module, and switch over to the pure python interface if pypy is found.
As it stands I have to do it manually in my module's __init__.py.

*Is there any way to detect if my module is being imported by pypy vs
cpython?* Either via sys, or maybe some latent variable that is present, or
something else. sys.argv[0] only has the script name (obviously), not the
interpreter call.

Keep up the outstanding work. Pypy is great!

Thanks!
Blaine
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to