Tuesday, September 16, 2008

Parallel Profiling

Did some profiling during my lunch break, since I was curious to see how a one-day implementation of a parallel library would perform against a super rival like Microsoft's TPL. This simple console app has been run in release mode, so no debug stuff lying around. My work laptop's a Fujitsu-Siemens Amilo Pro, Intel Core Duo 1.86 GHz, 1.75 GB RAM.

Rainweaver.Parallel Tester


100000 iterations Bessel function.
Comparison mode.
Parallel (RNW): 21076 msecs elapsed.
Parallel (TPL): 15877 msecs elapsed.
Sequential: 44302 msecs elapsed.
Ratio: Parallel RNW is 2,1020117669387 times faster.
Ratio: Parallel TPL is 2,79032562826731 times faster.

The results are pretty self explanatory, considering noise and everything. While this makes me a bit sad, I'm still happy to see that the difference is not that humiliating - at least, that's how I see it, and it's granted it could be oh so much better. All in all, my implementation is not optimized nor has been given that much forethought, so I can consider this a small step towards Nirvana and a great first-hand experience in parallel coding, which is invaluable.

I'd like to congratulate the TPL team on an awesome job. Can't wait for the release of this great library.

Monday, September 15, 2008

Coming next...

I've been dealing with a few interesting issues and finalized a good part of my base libraries. The time has come for me to start working on Darkmana. I've been messing around with my codebase to find out I was misusing a bunch of objects, resulting in a few annoying exceptions while using TV3D. Hopefully the problem has been understood; the lessons is, when dealing with multithreading, don't assume to follow the same sequential logic you'd use normally. This might be a given, but it's usually not. One enters in this focused state of mind in which everything clicks perfectly, just to find out an important thing has been left out at the very base of the structure.

Enough intro. In the next days, I'll commit some time to work on these subjects:
  • Parallel library: why, yes, even if there's one available for download over at Microsoft, I needed to roll my own. I can't rely on their release date (which is unknown at the moment) and on code in beta stage (adding to my own). Luckily a superb Channel 9 video with a throrugh explanation helped me disentangle a few doubts (link for the interested).
  • Using the above library to create a proper loading screen. Loading screens are cool, but only if I'm the one making them, otherwise they're annoying as hell. I'd love to let the player move the main character around until the world fades in around him upon load completion. Wouldn't it be cool? I think so.
  • Programmatic animations and AI. This is going to become a big matter, there are so many things I need to finalize first.
  • User interface: that will be one of my last concerns. I'd rather have a simple guy running around and jumping than a working user interface at the moment. I have learned a lot from my past experiments with user interfaces, and this time I'm sure it won't be as painful as the first time (I'm not even considering the actual first time, since it was a mess :P).
The people who subscribed in our forums for the beta version will receive the link to download the various tests I'll be uploading (when there's something juicy for them to test of course).