freevec.org - Features of libfreevec
Genesi Home Home Features Docs FAQ Whitepapers Benchmark Download
Features of libfreevec
Features of libfreevec

The "features" of libfreevec, are best described in terms of which functions are implemented, what is the status, and what perfomance gain can be expected from using each one, along with some comments.

For this purpose, the following table was created, use it for reference. Note, each function implemented uses exactly the same definition as the GLIBC one, ie the same return type and the same number/type of arguments.

Function namePart ofStatusAverage gainComments
GNU libc memory functions
memcpyGLIBCDONEup to ~4xbetter use it on sizes > 16
mempcpyGLIBCDONEup to ~4xsame
memccpyGLIBCDONEup to ~7xdepends on first the position of 'c'
memmoveGLIBCALMOSTXneeds a little more testing
memcmpGLIBCDONEup to ~4xdepends on the first difference
memchrGLIBCDONEup to ~4.5xdepends on the first position of 'c'
memrchrGLIBCDONEup to ~4.5xdepends on the last position of 'c'
memsetGLIBCDONEup to ~3xlibmoto version is twice as fast...
memfrobGLIBCDONEup to ~20xNice silly function, to show of AltiVec :-)
bcopyGLIBCDONEXimplemented using memcpy()
bcmpGLIBCDONEXimplemented using memcmp()
bzeroGLIBCDONEXimplemented using memset()
swabGLIBCDONEup to ~9x~twice as fast if dest is word aligned
GNU libc string functions
strlenGLIBCDONEup to ~2xstill needs work, libmoto gets 4x
strnlenGLIBCDONEup to ~5xprobably can get more
strcpyGLIBCALMOSTup to ~2xSee notes
strncpyGLIBCIN PROGRESSXa memccpy with length limit
strcatGLIBCTO-DOX
strncatGLIBCTO-DOX
strcmpGLIBCDONEup to ~7xSee notes
strncmpGLIBCDONEup to ~5xSee notes
strcasecmpGLIBCTO-DOX
strchrGLIBCTO-DOX
strrchrGLIBCTO-DOX
strstrGLIBCTO-DOX
strcasestrGLIBCTO-DOX
strfryGLIBCTO-DOX
libstring (MySQL) functions
bmove512libstringALMOST~1x (!)something's fishy
strfilllibstringDONEup to ~7.5ximplemented using memset()
strappendlibstringTO-DOX
strcendlibstringTO-DOX
strcontlibstringTO-DOX
strendlibstringTO-DOX
strmakelibstringTO-DOX
strmovlibstringTO-DOX
strnmovlibstringTO-DOX
Others
adler32?DONEup to ~2.5xAdler32 hashing algorithm
3 hashing alg.?DONEup to ~7xhashing algorithms from Berkeley DB
Insertion sort?DONEup to ~4xseparate functions for char, short, long, float. The char version actually can be up to ~50x faster
N-way Merge sort?DONEXN-way scalar, AltiVec version soon
Quick sort?ALMOSTXMajor pita, quite complex, but almost there
Notes:
  • DONE: Function is finished and tested, perhaps might use a little further optimization.
  • ALMOST: Function is in an almost working state, but fails to produce exactly the same results as the original scalar code
  • TO-DO: Nothing/Very little done yet
  • Testing is done very thoroughly against multiple combinations of alignment (both source and destination if applicable), sizes and other variables. If a function is reported as DONE, you can be sure that it produces exactly the same results as the original.
  • About strcmp/strncmp: I'm sure these can get even faster, there are things I'm not entirely happy about right now. Their performance also depends on where str1 ends or where the first difference between the two strings is. It's possible that it will appear slower in some cases (eg. str1 ends in just the first few bytes).
  • About strcpy: Likewise. I'm not happy with the performance right now. For unaligned data it can get get up to ~4x faster than GLIBC strcpy, but that's because the GLIBC version doesn't handle alignment properly. For aligned data, GLIBC strcpy is slightly faster. And libmotovec, completely trounces both, giving almost 4x the speed of GLIBC. So, it _must_ be possible and I may be doing something wrong. I'm putting this as ALMOST done, even though it works ok, because I want to improve its performance.
Copyright © 2005 Konstantinos Margaritis
(This site was created using site backend code by Matt Sealey at Genesi
Graphics by André Siegel)