gnustep-dev
[Top][All Lists]
Advanced

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

perfomance optimisations


From: David Wetzel
Subject: perfomance optimisations
Date: Tue, 05 Apr 2005 19:07:18 +0200

hi folks,

I think we should not introduce a lot more IMPs in GSWeb than we now have.
There are other areas that should be addressed.

This is a example of a potential thing that could be faster.
If somebody uses cString it is likely that he also uses cStringLength on the 
same string.
Both does basically the same. Has somebody an idea how to optimize here?

- (const char*) cString
{
  NSData        *d;
  NSMutableData *m;

  d = [self dataUsingEncoding: _DefaultStringEncoding
         allowLossyConversion: NO];
  if (d == nil)
    {
      [NSException raise: NSCharacterConversionException
                  format: @"unable to convert to cString"];
    }
  m = [d mutableCopy];
  [m appendBytes: "" length: 1];
  AUTORELEASE(m);
  return (const char*)[m bytes];
}

- (unsigned int) cStringLength
{
  NSData        *d;

  d = [self dataUsingEncoding: _DefaultStringEncoding
         allowLossyConversion: NO];
  return [d length];
}


dave

---
   _  _
 _(_)(_)_  David Wetzel, Turbocat's Development,
(_) __ (_) Buchhorster Strasse 23, D-16567 Muehlenbeck/Berlin, FRG,
  _/  \_   Fax +49 33056 82835 Phone +49 33056 82834
 (______)  http://www.turbocat.de/





reply via email to

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