[Openmcl-devel] Re: Hemlock performance investigation

alex crain alexcrain at mail2.widgetworks.com
Sun Aug 29 01:12:10 UTC 2004


On Aug 28, 2004, at 12:00 PM, Hamilton Link wrote:

> OK, the following addition by Gary (can't hardly go to bed late enough 
> or get up early enough to keep up with that guy) makes layout WAY 
> faster, when the file is opened and just in general. So typing is 
> lickety-split now and maybe Gary won't have to get coffee when hemlock 
> is opening large files any more. Thanks Gary and thanks to all that 
> provided quality pointers into the Cocoa documentation (he says, as he 
> turns around and does a random insertion of said material into his in 
> box).

Hey kids.

I've been following the discussion but I'm on vacation and I'm hacked 
into a random Wifi network with a very weak signal so I'm mostly 
offline and haven't been responding.  (I have to sit in a certain spot 
on the porch of my hotel - it's probably for the best)

Garys solution certainly works well enough interactive use but I think 
that there is an opportunity for improvement. I've been digging, and it 
looks like the fundamental issue is that NSLayoutManager is trying to 
layout ~3000 glyphs for every insertion. This strikes me as 
particularly unbright since there are only 1920 visible characters on a 
24x80 display and
a more typical number is ~800 visible characters.

Interesting - If the file is > ~3500 characters, NSLayoutManager does 
not try to layout the entire file, but does layout more then the 
visible area. I'm thinking that it's working with a virtual screen 
behind the scrollbars and is checking to see if inserting the new glyph 
changes the position of any of the other displayed glyphs.

Now, we know something that NSLayoutManager does not know, in that we 
are using a fixed width font. It seems likely that this will always be 
the case, as working with variable fonts in a programming editor is 
evil, so I've been looking for a way to explain that to the layout 
manager  so that it will simply shift all the glyphs on a line over one 
and do the insertion.

The good news is that I managed to get it to work. That bad news is 
that I was working in a dynamic environment and I can't remember 
exactly what I did to make it work. I did, however
see some behavior where I was editing a 14K file and each insertions 
was generating about eight calls to :character-at-position and six to 
:get-characters.

I'm going back to my digging, but if anyone has any suggestions I'd 
like to hear them.

:alex





More information about the Openmcl-devel mailing list