[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance patch for large texts

From: Fred Kiefer
Subject: Re: Performance patch for large texts
Date: Fri, 18 May 2001 23:51:17 +0200

Frederic wrote:
> But I also met some performance issues:
> 1. Open takes 59sec on my machine (Linux 2.4 Pentium II 350MHZ, 256mo)
> 2. Resizing the document window takes 40sec.
> I attached a quick and dirty patch that improves a little bit the
> performance:
> 1. Open: 16sec
> 2. Resizing: 2sec
It looks like your performance hack tries to avoid calling the [string]
method on NSTextStorage, and really saves a lot of time with this. But I
am not sure, if the way you do it is correct. (Beside you seem to have
left out a lot of places, where changes would be needed. We should
integrate all the changes you made to the functions inside of
NSStringDrawing, but we should also keep the external interface of the
This reraises and old issue:

On the 19 Sept. 2000 Richard Frith-MacDonald wrote:
> However - it's definately a bug in GSTextStorage that it returns its ivar, so
> I've modified it it to return an autoreleased copy, and changed NSText to not
> copy the result.
> I guess that if it turns out that we *really* need fast access to the ivar
> >from NSText, we should probably add a hack to use @defs to get direct access
> to the internals of the GSTextStorage class.

I think that this has now been proved. And we will have to hack
something into NSStringDrawing to make the last needed call to get the
string faster. As we cannot be sure, if the parameter of type
NSAttributedString is a GSTextStorage, we better add a method
[directString] to NSAttributedString and all its subclasses which
returns the internal string, without copying it. This should have almost
the same performance benefit than the changes Frederic did propose,
without further interface changes. 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]