Re: faster strcpy()

kwrohrer@enteract.com
Sun, 26 Apr 1998 15:41:17 -0500 (CDT)


And lo, Alexander Kjeldaas saith unto me:
> Once upon a time, I was interested in compilers (guess I still am) and
> it bothered me that languages often need null-terminated strings to be
> compatible with the "C"-world. So I came up with the idea that in my
> compiler, I would pad all strings to be a multiple of the word-size of
> the machine. Then I would use between 4 and 1 null-bytes to terminate
> the string. That way, I remained compatible with C, but in all the
> str* routines, I only have to check one byte to know if I had come to
> the end of the string.
So what part of strtok's behavior would you break? (Assuming you could
get the compiler to align all your strings right...)

> It doesn't use any more memory either unless
> you want to pack strings really tight, something you usually don't
> want to do to avoid alignment problems.
Unless, of course, you're dealing with substrings...

>[Maybe this could]
> be used in the Linux kernel on architectures with less-than-optimal
> support for null-terminated strings.
Code which is already libc-free (like the kernel) is a good place in
general to try this. Just don't expect userland to cooperate, and
make it a config option for the poor folks with 4-8 megs of RAM...

Keith

-- 
"The avalanche has already started; |Linux: http://www.linuxhq.com     |"Zooty,
it is too late for the pebbles to   |KDE:   http://www.kde.org         | zoot
vote." Kosh, "Believers", Babylon 5 |Keith: kwrohrer@enteract.com      | zoot!"
 www.midwinter.com/lurk/lurker.html |http://www.enteract.com/~kwrohrer | --Rebo

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu