SSE in libthr

Alan Somers asomers at
Fri Mar 27 23:03:12 UTC 2015

On Fri, Mar 27, 2015 at 4:36 PM, Adrian Chadd <adrian at> wrote:
> hi,
> please don't try to microoptimise crap like strlen().
> The TL;DR for performant high-throughput code is: if strlen() or
> memcpy() is the thing that's costing you the most, you're doing it
> wrong.
> -adrian

I respectfully disagree.  A well-optimized libc will benefit
_every_single_program_ that uses strlen.  That includes Apache, Samba,
Memcached, Quake, and basically every single program that every single
FreeBSD user uses.  There's no reason that 3rd party software
maintainers should have to rewrite basic libc functions in order to
get decent performance on FreeBSD.  And the downsides are so small!
In 2015, we should assume by default that most userland software is
using SIMD instructions.  As Eric noticed, Clang emits them freely.
What's the point to lazily saving the SSE registers on context
switches if essentially all programs compiled from Ports will be using
those registers anyway?  I agree with Jilles; I think we should always
save the SSE registers for userland programs.


More information about the freebsd-current mailing list