[interfacekit] BString revamp

Hi!
After some time that I couldn't program very much for OBOS, I am now back.
I did some performance testing on my BString implementation, and decided to=
 
rewrite some functions, because it was not as fast as R5 one. You shall not=
 
see any checkin since I want to complete the rewrite first.
And I hope you don't see this as premature optimizations, since tests have 
already been written for BString, and I can test it well against them :)

And now the good news :)

Here's some tests I did:

#define ITERATIONS 10000

int main()
{
=09BStopWatch *watch;
=09
=09PRINT(("CharacterEscape(char)\n"));=09
=09BString string("abzcabcahbcccdazbdcabcdahjebacbdhehrijgrzhue");
=09watch =3D new BStopWatch("String");
=09for (int x =3D 0; x < ITERATIONS; x++)
=09{ 
=09=09string.CharacterEscape("ahz", '/');
=09}
=09
=09delete watch;
}

I compiled this little program with R5's BString and with OBOS one.
These are the results:

CharacterEscape(const char*, char*)

OBOS: StopWatch "String": 6881603 usecs.
R5: StopWatch "String": 35313129 usecs

CharacterDeescape(char),  1000000 iterations

OBOS: StopWatch "String": 198041 usecs. 
R5: StopWatch "String": 189282 usecs.

CharacterDeescape(const char*, char), 1000000 iterations (way faster, am I 
missing something?)

OBOS: StopWatch "String": 4545007 usecs
R5: StopWatch "String": 10563255 usecs

Anyway, I'm still here :)

Bye!

Other related posts: