From owner-freebsd-current@FreeBSD.ORG Fri Mar 27 23:03:12 2015 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 69B0AAB5; Fri, 27 Mar 2015 23:03:12 +0000 (UTC) Received: from mail-oi0-x230.google.com (mail-oi0-x230.google.com [IPv6:2607:f8b0:4003:c06::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2A54C3DC; Fri, 27 Mar 2015 23:03:12 +0000 (UTC) Received: by oigz129 with SMTP id z129so43524743oig.1; Fri, 27 Mar 2015 16:03:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Zn7FqMUw7chUqv8NDXvaF8iJJQip2F46p/hb6pEyyA0=; b=XoDfoLV1+8DnseKhqR5SbhWvT1gIcY0NpVg083xCccI2kZMXAi2BCFcRryqHajeITW ENoOeWD30fa+EJU1EVVNTJwgCf4yi6UjPcOWWVqf7Tym5VwAd67iDvI+JXw2HcdO0E4r 9DcQmhAIErlXYwFBGXy0925dTA4KJM9PHsiGPO1sBifhZdE7M++/ynP1FPhlDCTx6Den iqjAf8pz9EzQhY3fiwO3vBjdgUx1djV/8CCeynDHkfGKGE4EJTFtf/U4tv9BU3AKsqdX EPiHpzmnYTFGEuwvEHJaaQ88zf3No3OKbYxDRfiPhS1TUH/D8y0U+B8Xf/jNd9iLRRuI FPWQ== MIME-Version: 1.0 X-Received: by 10.182.121.225 with SMTP id ln1mr17991202obb.65.1427497391496; Fri, 27 Mar 2015 16:03:11 -0700 (PDT) Sender: asomers@gmail.com Received: by 10.202.215.7 with HTTP; Fri, 27 Mar 2015 16:03:11 -0700 (PDT) In-Reply-To: References: <5515AED9.8040408@FreeBSD.org> <20150327214057.GA3766@stack.nl> Date: Fri, 27 Mar 2015 17:03:11 -0600 X-Google-Sender-Auth: VF9FS5-BXHHKbEoAorF993j6fJM Message-ID: Subject: Re: SSE in libthr From: Alan Somers To: Adrian Chadd Content-Type: text/plain; charset=UTF-8 Cc: Eric van Gyzen , "current@freebsd.org" , Jilles Tjoelker X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Mar 2015 23:03:12 -0000 On Fri, Mar 27, 2015 at 4:36 PM, Adrian Chadd 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. -Alan