Switched to cython

Standard

I had to spend a couple of hours today rewriting some code after reading about Cython.
I rewrote the C module to a Cython file. It runs at about 1.33 the speed of the C module, but I believe that’s mainly because I’m using tuples all over the place instead of C structs. My guess is that the decrease in speed would become very moderate after optimizing. The new module also got rid of a bug in the C module where objects would disappear when being too far from the viewing plane.
Even if after optimizing there isn’t a huge performance gain, I think the penalty would be well worth it. The code is less than half the length and didn’t take long to write..

Here is an image:


Again, two identical, separated spheres.
There is also some primitive lighting. Note the “banding”… It is caused because the program is rounding floats to ints. Shouldn’t be very tough to fix.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s