Bug 73111 - Optimized libc string functions missing for amd64
Summary: Optimized libc string functions missing for amd64
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: amd64 (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: David E. O'Brien
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-25 13:00 UTC by will
Modified: 2005-06-19 13:00 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description will 2004-10-25 13:00:56 UTC
Using optimized assembly language versions of string functions on amd64 (this is already done on other architectures) would probably be a good idea.

Functions adapted from NetBSD (which can be extracted into /usr/src for inclusion in a buildworld) are available at the following URL:
http://will.iki.fi/patches/libc-amd64-string.tar.gz

I mentioned the issue on -current, but this didn't result in any discussion.

The NetBSD functions may or may not all be desirable in their current form; some of the functions have extensive unrolling and may produce a performance penalty for short strings (but a huge advantage for longer ones).
Comment 1 gurney_j 2004-10-25 18:03:20 UTC
Ville-Pertti Keinonen wrote this message on Mon, Oct 25, 2004 at 11:53 +0000:
> >Description:
> Using optimized assembly language versions of string functions on amd64 (this is already done on other architectures) would probably be a good idea.
> 
> Functions adapted from NetBSD (which can be extracted into /usr/src for inclusion in a buildworld) are available at the following URL:
> http://will.iki.fi/patches/libc-amd64-string.tar.gz
> 
> I mentioned the issue on -current, but this didn't result in any discussion.
> 
> The NetBSD functions may or may not all be desirable in their current form; some of the functions have extensive unrolling and may produce a performance penalty for short strings (but a huge advantage for longer ones).

Have you run some benchmarks to validate that the assembly optimized
code is faster than the c generated?  if you need help analyzing the
benchmark numbers, look at ministat in src/tools/tools/ministat...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."
Comment 2 David E. O'Brien freebsd_committer freebsd_triage 2004-10-25 19:39:12 UTC
Responsible Changed
From-To: freebsd-amd64->obrien

I've got some input from AMD on these.
Comment 3 will 2004-10-26 09:02:03 UTC
John-Mark Gurney wrote:

>Have you run some benchmarks to validate that the assembly optimized
>code is faster than the c generated?  if you need help analyzing the
>benchmark numbers, look at ministat in src/tools/tools/ministat...
>  
>
Yes.  There is little enough variation to make statistical analysis 
pretty much unnecessary.  All of the functions are faster on strings 
 >=64 bytes in length (with aligned buffers, but that's fairly typical 
in real-world use).  For large enough strings, all of the functions are 
at least 5 times as fast, and at best over 10 times as fast.

The C functions are pretty bad, especially the block copy/set functions 
(they're using , at best, int-sized -- 32-bit -- operations).

A simplistic test I used (including results) can be found at 
http://will.iki.fi/misc/strtest.tar.gz
Comment 4 Matteo Riondato freebsd_committer freebsd_triage 2005-06-19 12:59:00 UTC
State Changed
From-To: open->closed

Fixed and MFCed.  
See: 
http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/amd64/string/memcmp.S 
http://lists.freebsd.org/mailman/htdig/cvs-src/2005-April/044356.html