Mail Archives: djgpp/1998/02/26/22:02:07
Eli Zaretskii wrote:
> In any case, I would suggest profiling your program first, to see
> where does it spend most of the time. See chapter 13 of the FAQ for
> more details.
I second this! When I profiled my editor to find out why it took so
long to update the screen, I found that the slug was nowhere near where
I thought it was. Turned out I was calling a function ~80 times per
line, and this function had a multiply instruction in it. Even though I
wrote every line of code involved (some of it asm!!), I would never have
found this slug without using a compiler. BTW, my editor went from a
craw at 34 lines to snappy at 60 lines, just by changing the update
algorithm.
As Michael Abrash says, profile, profile, profile! check your algorithm
and profile again. Changing the algorithm can give you more gains than
tweaking assembly. I'm not belittling pgcc or assembly, just get your
algorithm right first, then worry about code generation (I learned this
the hard way).
Bill
--
Leave others their otherness
- Raw text -