On 8 Feb 2010, at 07:41, Wolfgang Lux wrote: > Hi Richard, > >> Author: rfm >> Date: Thu Aug 27 16:57:00 2009 >> New Revision: 28556 >> >> URL: http://svn.gna.org/viewcvs/gnustep?rev=28556&view=rev >> Log: >> Fix bad return of proxy to user code >> >> Modified: >> libs/gui/trunk/ChangeLog >> libs/gui/trunk/Source/GSTextStorage.h >> libs/gui/trunk/Source/GSTextStorage.m > > > I don't know what you attempted to fix here, but your change is definitely > wrong and the old code which did return a proxy was correct. Here is the > relevant quote from Apple's documentation of the NSAttributedString -string > method: > > "For performance reasons, this method returns the current backing store > of the attributed string object. If you want to maintain a snapshot of > this as you manipulate the returned string, you should make a copy of > the appropriate substring. > This primitive method must guarantee efficient access to an attributed > string's characters; subclasses should implement it to execute in O(1) > time." > > Your change has introduced a nasty O(n^2) performance bug that makes a > machine with a GB of RAM start thrashing during text layout when loading > a ~100kB log file into a text view. > > Wolfgang > > PS: I've notice that GSAttributedString contains the same bug.
Thanks very much ... I had a bug report from someone who was bitten by the string mutating later on in their code when they thought it was immutable (an NSString), and I forgot that this was actually a documented feature. I'm reverting that change, and will tell them the bug is in their code not ours. _______________________________________________ Gnustep-dev mailing list [email protected] http://lists.gnu.org/mailman/listinfo/gnustep-dev
