This is the README for RCString.s.tar.gz [Download] [Browse] [Up]
RCString - An implementation of a Reference Counting string class. -------- It seems to me that since we can make a Class have anything we want, and we know that people love to argue about the merits of C-style, null terminated strings vs. Pascal-style "counted" strings, an Obj-C String class ought to be both. That way we've got the flexiblity of null-termination, and the efficiency of knowing the string length up front. The fact that it's an object should relieve problems with Pascal-style counted strings: we can use any size representation of the string length we want, not just the initial byte. So, keeping length of string around in an instance var should minimize calls to strlen(), which are bound to get expensive. It should also allow the use of bcopy() instead of strcpy(). Hopefully, vendor's C library bcopy() will be cognizant of cache blocking, loop unrolling and so forth, and will be faster than strcpy(). The other thing that's really expensive about both C and Pascal style strings is memory allocation/deallocation. The obvious solution to that is "refence counting." Reference counting makes the object 'copy-on-write', I guess. It should minimize calls to bcopy(), malloc() and free().
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.