[Pyrex] How to prove better Pyrex performance?

William Stein wstein at gmail.com
Fri May 30 20:14:46 CEST 2008


On Fri, May 30, 2008 at 10:06 AM, Daniele Pianu <muogoro at gmail.com> wrote:
> I've to write a Python script that shows the better Pyrex performance
> against Swig performance. I've to highlight the overhead due to
> different layers of Swig wrappers, instead of Pyrex wrappers which
> have only one layer made up of Python/C Api calls. I think I need to
> write something like a wrapper of a C library that does mathematical
> stuff. Could it be a good example? Every advice is welcome.
>

I think it is VERY important that you explain who your target
audience is.   Pyrex is vastly better than Swig for *certain*
types of wrapping, but for others I think for other types of
wrapping it doesn't matter much.

So, who exactly do you want to show this benchmark to?

By the way, my personal experience with this was four years
ago, when I wrote a C++ class to do arbitrary precision integer
arithmetic using the GMP library.  I then wrapped it in Swig,
which meant that every object creation (e.g., multiplication)
meant creating a pure python object that wrapped a C library
object, etc.   I then wrote code to accomplish the same thing
in Pyrex, and that's when I realized Pyrex is brilliant.

 - William


More information about the Pyrex mailing list