View RSS Feed

code_glitch

Premature Optimization: It could be worse...

Rate this Entry
I often find that many people will say exactly the first part of the title and claim that premature optimization is the root of all evil... I beg to differ. The true root of all evil is simply boredom. Ever felt bored, thought 'hey thats sort of unnecessary and totally crazy?' - I did. For two weeks.

I came up with:

  • Completely weird idea for tile based particle effects (I mean WTF?)
  • Added multi threading to that POC (Proof of concept) code. So I made POCPOC code...
  • Then I figured, that only crashes once every so often. Same thing: OpenAl...
  • So I had some POC code that didn't work too well in OpenAL and thought 'its good enough'
  • So I added multi threading to it (stream from disk, update buffers, loop and etc...)
  • So I had BPOCPOC (Broken POCPOC) code.

And then I remembered: Prometheus, Luduum dare. Combine: YAA!
At this stage there were no optimizations. I achieved to add POCPOC and BPOCPOC code to a library that currently has some of its own POC code in it. Right now, a 30 line program throws up an unhandled exception once every .3 seconds (cycling main loop at 40 cycles/sec). GDB can't handle that for some reason it crashes also but my program doesn't. You just get some garbled audio and random colours on screen flash fast enough to kill an epilaptic turkey 50 times a second

All in all, my recommendation is: when you have POC code, stabilize and optimize before integration. And integrate before adding more POC code otherwise: BAM!

Besides that, I'm having a shot at humane particle fx for the next release of Prometheus (may not be next commit since there is xfont (needs a new name) for faster font rendering (SDL is driving me insane. only 30% speed of everything else ) so check it out if you're bored...

Reminds me, my rendering in Prometheus could use a boost as ZenGl thrashes it like crazy at the moment but thats a whole different story.

PS: Oh yes, and epileptic turkeys FTW!

Submit "Premature Optimization: It could be worse..." to Digg Submit "Premature Optimization: It could be worse..." to del.icio.us Submit "Premature Optimization: It could be worse..." to StumbleUpon Submit "Premature Optimization: It could be worse..." to Google

Tags: None Add / Edit Tags
Categories
Uncategorized

Comments