Brainfold On Python, game development and everything

29Mar/10Off

PyEigen 0.2 teaser

I just want to assure everyone that development of PyEigen didn't stop at the 0.1 release and I've put many hours into the next release already. I have almost finished rewriting everything using C++ templates; might as well take advantage of C++ features since Eigen requires a C++ compiler anyway. Lines of code have been cut almost in half and maintenance will be much easier in the future. Here are some of the major upcoming features (subject to change, completed features will be in bold):

  • Python 3 support
  • Matrix iterators
  • Variable-size vectors and matrices

In other news, I just found about PyBindGen, which looks very promising compared to other binding generators, and might be worth checking out for a future version of PyEigen. Can someone speak for or against it? I'm mostly worried about performance, since I want PyEigen to be as fast as possible; after all, that's the sole reason I started the whole project.

Update (2010-03-30):
Matrix iterators done, slicing dropped (you can just convert to a list first).

Update (2010-05-03):
Quaternions and transformations postponed to the next release, variable-size matrices done.

Share this blog post:
  • Digg
  • Facebook
  • Twitter
Comments (6) Trackbacks (0)
  1. Never thought you were into such stuff. Also otherwise perceive you as a much more professional fellow here than I am used to normally. Maad.

  2. As the author of pybindgen, I should warn you that it is not supporting Python 3 yet. It should not be too hard, but I haven’t had enough time and motivation yet.

    From the benchmarks I have done ( http://telecom.inescporto.pt/~gjc/pybindgen-benchmarks/ ), I think PyBindGen is pretty fast, except with overloaded methods/functions/constructors, then it is slower than some other solutions.

    Cython is pretty fast too. I just don’t like the overall complexity of the code generator and the ugliness of the generated code. And it has less mature support for C++ features, last I checked.

  3. Yes, that’s exactly why I dropped Cython. Maybe I’ll take a look at PyBindGen when it has Python 3 support *hint* :)

  4. “Cython is pretty fast too” is a little underestimated. It clearly beats PyBindGen into pieces in terms of performance:

    http://behnel.de/cgi-bin/weblog_basic/index.php?p=38

    That’s simply because it is an optimising compiler, not a glue code generator. You’ll often have a hard time writing code by hand that can compete with the C code that you get by throwing a couple of simple type declaration into your Cython code.

    The C++ features have heavily matured and were recently merged into mainline. The soon to be released Cython 0.13 will have support for all sorts of fancy C++ features:

    http://wiki.cython.org/gsoc09/daniloaf/progress

    We’ve started overhauling the original C++ tutorial, but that keeps being work in progress:

    http://wiki.cython.org/WrappingCPlusPlus

  5. Thanks for the update Stefan! I’m keeping an eye out for Cython and any other solutions out there, but I might try to avoid rewriting PyEigen too many times in the future unless there are very clear benefits. :)

    A huge benefit of using the Python C API is the lack of additional dependencies, and since Eigen is a C++ library anyway, I can use the power of C++ templates to avoid a lot of boilerplate code.

  6. Except as I just checked out the upgrades, there still doesn’t seem to be support for C++ references, which was the main reason I couldn’t use Cython in the first place. Waiting for that before a re-evaluation, then!


Leave a comment


Trackbacks are disabled.