[chaoscope] Development update

  • From: Nicolas Desprez <freelists@xxxxxxxxxxxxx>
  • To: chaoscope@xxxxxxxxxxxxx
  • Date: Mon, 07 Jun 2010 22:38:49 +0100

Hi all,

Believe it or not I have been working on Chaoscope for the past few months. I've worked on new features that weren't planned but will be part of the new release (supersampling, rendering recovery, etc.) and some features that are far too experimental to make the cut (ambient occlusion).

Also, at the end of last year I came across a performance related mystery while I was comparing rendering time between the development version and the current release, 0.3.1.

For the same project, the version in development gave me results varying between 7 and 21 million iterations per second. All I was doing was closing a project, opening the exact same project again and rendering it. Nothing changed in the code between two subsequent renders; the exact same rendering path was executed.

To cut a long story short, I finally discovered that the Borland compiler didn't necessarily store variables or arrays of type double on an 8 bytes aligned address. I don't think this was an issue on old processors but it appears to have a massive performance impact on Core Duo models, and possibly on more recent models as well.

I do spend an awful amount of time optimising the code and tweaking a line here and there to squeeze as much power as I can from the CPU the program is running on. So this was a big blow, realising that no matter how much effort I'd put into optimisation I'd always be double-guessed by the compiler which would find a clever way to make my code run slowly.

Even though I found a solution to this alignment issue (which required rewriting large portions of the code) I came to realise that I'd have to give up the Borland compiler, at least for the rendering.

So in the beginning of February I eventually decided to port the code to generic C++. By generic I mean platform and compiler independent. I currently have the rendering part of code compiling on Microsoft, Intel and GNU C++ compilers. I took this opportunity to rewrite the code from scratch. I also had to code the matrices operations that were handled by OpenGL before so that OpenGL support isn't a prerequisite anymore. The code is multi-threaded where possible, thanks to OpenMP 2.0.

This was a long and tortuous process that I've only completed recently. The result is one multi-threaded DLL and a command line executable that can render a project and save an image. The rendering doesn't include anti-aliasing yet. So it's far from being the full application.

However, it can be compiled into a 64 bits executable, and most likely on Linux and Mac OSX. The other advantage is it will definitely run faster. I can't give you precise figures yet because I need to compare apples with apples, but I expect the same project to render at least twice as fast with the new code.

What's left to do before I can release this is implementing anti-alias, multisampling and batch processing. It won't take 4 years, and it won't take long beta testing either because the features are so basic.

I wanted to wait until this was ready for public release before announcing anything because I've been keeping you guys up to date for the last few years and nothing happened yet.

The next step would be to replace the original (Borland compiled) batch processing with the new code. Eventually I should have the application split between backend/core features (in generic C++) and interface (in Borland, then C# later). This would make porting to other platforms much easier.

As far as open-sourcing the project, I want to find out first if there's a way to make a living out of it. Obviously I haven't spent enough time or energy during the past four years to make this possible but I want to give it a go now before I shoot myself in the foot and give months of research away. It could be an iPhone, iPad and/or Android application, posters or t-shirts sales, a screen saver or advertisement on the site (these last three options would work out alongside an open source project). I haven't decided yet.

I'd like to take this opportunity to apologise to the forum subscribers where I've been more than inactive, and people who've sent me emails I haven't replied to yet. I've been dedicating most of my spare time to development, and I'm much faster at writing C++ than I am at writing English!

Regards,

Nicolas Desprez
======================================================
The Chaoscope mailing-list
Archives : //www.freelists.org/archives/chaoscope
Admin contact : mailinglist@xxxxxxxxxxxxx
Web site : http://www.chaoscope.org
======================================================

Other related posts: