Speed Up tricks Revisited

Discuss PocketC for Palm OS (including Desktop Edition)

Postby ziggystar on Mon Jan 12, 2004 4:32 pm

I was wondering if we could start a thread of what commands are faster etc... I know I saw a previous post about different tricks, however some of those tricks no longer seem to work with os5 and/or pocketC 6+. Like the Dynamic memory allocation seems to actually be slower on the simulator and my Sony Ux series.

For Instance.

Is Faster then


then what is faster?
X++;X++; or x=x+2;?

then the more complicated things.

Is Line faster then BitmapR ?
I wish there was a approximate scale we could use like the fastest command

X++; = 1 time unit
x=x+1; = 2 time units
X*4; = 3 time units
Bitmapr = 10 Time Units

and so on. I think this would really help!
Posts: 6
Joined: Wed Jun 18, 2003 4:10 pm
Location: USA

Postby jstadolnik on Mon Jan 12, 2004 8:08 pm

See the speedopts.c file in the PToolbox release. It contains quite a number general PocketC speed optimizations.


The PToolboxLib guy.
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby wolfgang on Tue Jan 13, 2004 5:54 am

Just food for thought: To my experience in any program there are only very few places where spending time on speed optimization makes sense. Mostly screen refresh (re-drawing) or rendering stuff, and all places where you have loops that get repeated often, or nested loops (optimize the innermost and usually that gives you already 99% of the possible speed gain). Picking the "right" commands is good (can get you a few percent faster), but picking the right algorithm is usually better (can sometimes get you orders of magnitude faster). So time spent on optimizing the algorithm yields far more improvement than spending the same time tweaking single commands. E.g. don't try to speed up Bubblesort by searching for the fastest way to swap two variables; use Quicksort instead. Etc.


Composing music on the PocketPC! - http://www.pdamusician.com
Composing music on the PocketPC! - http://www.pdamusician.com
Posts: 281
Joined: Tue Dec 12, 2000 4:22 am
Location: USA

Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 7 guests