gnustep-dev
[Top][All Lists]
Advanced

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

Re: additional methods in NSMutableString


From: Alexander Malmberg
Subject: Re: additional methods in NSMutableString
Date: Mon, 10 Jan 2005 23:53:47 +0100
User-agent: Mozilla Thunderbird 0.9 (X11/20041124)

Markus Hitter wrote:
Just to add a more general comment ...

One of the big advantages of OpenStep / Cocoa is it's simple, easy to
 remember API.

Adding methods also has disadvantages:

- GNUstep code becomes more complex and more difficult to maintain.
[...]
- Overall performance degrades: More methods for the dynamic linker
to consider, bigger libraries to load.

- Writing applications becomes more difficult since you have to
choose from a bigger set of methods. If you have several methods to
solve one problem and you just ignore some of them because you have
lost overview, the whole point of API extension is moot.

Agreed. I think we should be very careful when it comes to extending an
interface just to gain some speed. Performance is nice, but there are
other things that are more important. (Of course, there are also cases where performance is very important; a nice interface doesn't help anyone if it's too slow to be used.)

In this case, the methods aren't clearly "wrong", but I do think they're
on the edge. However, it looks like the existing NSString methods could
be rewritten to use the NSMutableString methods and
-makeImmutableCopyOnFail:; if that's possible, it would avoid the code
duplication and make the new methods easier to accept.

Manuel Guesdon wrote:
A last thing, performance is, IMHO, a key in GNUstep success so if we
can add few simple things to improve performance it may be
interesting to consider them.

Well, I think it's important for us to be fast enough, but I don't think raw performance is one of our strengths. This probably holds for objective-c in general:

* objective-c is not (and will never be?) as fast as c or c++
* objective-c is still close enough to c/c++ that in all but extreme cases, the difference doesn't matter
* in extreme cases, objective-c lets you fall back to pure c gracefully

(Remember that profiles indicate that GNUstep apps spend 15%-20% of their time in objc_msg_lookup, i.e. pure message sending overhead. Pure c doesn't have that. OTOH, Moore's law says that your computer will be 20% faster in ~5 months, so it'll even out eventually anyway. ;)

- Alexander Malmberg




reply via email to

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