[comp.sys.mac.programmer] ROM Proc bottlenecks?

ba0k+@andrew.cmu.edu (Brian Patrick Arnold) (07/28/89)

Hi there,

   in an attempt to find the cause of a visibly slow portion of my user
interface, I used MPW's performance tools to learn whether TextEdit in ROM
was the culprit.  The results turned out to be baffling, because I don't
recognize most of the following calls (45.5% outside the segments):

120   ROMII :       FMSWAPFONT   1495      0      0    11.4%
120   ROMII :       ATRAP68020   1185    222    297    10.7%
120   ROMII :      MEASURETEXT   1185      1      3     9.0%
120   ROMII :        ITABMATCH    606     61    121     5.1%
120   ROMII :          EMT1010    485      0      0     3.7%
120   ROMII :      COLOR2INDEX    354     32     86     2.9%
120   ROMII :        GETDEVPIX     77     30     40     0.8%

The code being tested is getting text from a non-styled TE record (TEView in
MacApp, in fact) and putting it into a styled TE record, and becomes visibly
slow after doing it about 10 times, and unbearably slow after about 20.
I don't know if I can call any of the above procs "bottlenecks", but my
(and MacApp's) procs couldn't even break 2% of the time spent, claiming
about 80 to 90% "outside the segments" which doesn't add up with the above.

If anybody could shed some light on what these procedures are or do, and
whether they have anything to do with TextEdit or MacApp, I'd appreciate
your kind advice.  And while I'm at it, I could say the program fragments
memory like crazy, a benefit from having been written originally for a Sun-III,
but minimized by some memory management code I've added between the original
code and the Mac MM.  The memory management code I added reduced memory
allocation time by 2 orders of magnitude in other areas of the program,
but the code I measured is mostly MacApp TEView or direct TextEdit calls.

Clues, hints or tips?

- Brian

paul@taniwha.UUCP (Paul Campbell) (07/29/89)

In article <UYnpjUy00WB4QBLP48@andrew.cmu.edu> ba0k+@andrew.cmu.edu (Brian Patrick Arnold) writes:
>
>120   ROMII :       FMSWAPFONT   1495      0      0    11.4%

You are spending about 10% of your time switching fonts or rebuilding
the font cache - don't do anything that causes the font cache to be
rebuilt each time (like setting scaling or fixed width etc before
each time you write text - set such options once and leave them
that way!)

>120   ROMII :       ATRAP68020   1185    222    297    10.7%
>120   ROMII :          EMT1010    485      0      0     3.7%

You are also spending 15% of your time in the system call code,
this is not uncommon, I've seen this as high as 70%! (Remember that
things like FMSWAPFONT etc make lots of calls of their own - so
reducing the time you spend in their chances you will spend less
time here too) [maybe Apple could spend time trying to make the A-line
glue faster - I've looked at it and that's probably pretty hard]



	Paul

-- 
Paul Campbell    UUCP: ..!mtxinu!taniwha!paul     AppleLink: D3213
"Free Market": n. (colloq.) a primitive fertility goddess worshipped by an
obscure cult in the late 20th C. It's chief priest 'Dow Jones' was eventually
lynched by an enraged populace during an economic downturn (early 21st C).