From nobody Sun Aug 06 23:20:18 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RJwRN5Vrpz4pZR2 for ; Sun, 6 Aug 2023 23:20:32 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RJwRN3Yyyz3P19 for ; Sun, 6 Aug 2023 23:20:32 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-307d20548adso2949828f8f.0 for ; Sun, 06 Aug 2023 16:20:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691364030; x=1691968830; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Oh05DwA/LquwktMXHUC1qwPa5KI9yYVZ+9vrRxz+e3w=; b=h2jbzNTIsVhUBtbQbSkPrG1QEm+SQFo2wfjkATeFYHrqynMvASXXYQqYFuY4Ut0e9w XHiqa+G90rgXxFFeLK3WT+xpCbPplEHDW9MJvkZd5hTYs8UpusKq+oAbLFIokylB1zed Nr010bMma27NHts6HJKNqzNTRb4tHPBtoAgYKOrPIHyeFhpiwVSH88hbf9hoTMA+pxeX D7KyBLAcsVX3TXfbJZ8qJ6VBX57Jbcruxonj6gTU+rOx+ftD2p0s17QN8gs7Z3L1Co9v t98fJ34zq87xUF/DM6XxZb55sOIDKQRir0SS2bLocA4ir4LIy0sYAHzmzuAKmeTcd/fP 4SLQ== X-Gm-Message-State: AOJu0Yxx6L53UdidsHXcAd+sL6+aZCzEozo5P7xK9zgpfyFupfKf0nvx rt/BaorAgP3gGIr8w90lpjLnQA== X-Google-Smtp-Source: AGHT+IFju6d96AsG7r/v/Wfe3pXRdAQlwCxXLucTfN1JeQ68X2vdtZ3MNMe1IGjS+VVwMZJBQ0yl/g== X-Received: by 2002:a5d:464a:0:b0:315:a1bb:4d7b with SMTP id j10-20020a5d464a000000b00315a1bb4d7bmr4170180wrs.35.1691364029752; Sun, 06 Aug 2023 16:20:29 -0700 (PDT) Received: from smtpclient.apple ([131.111.5.246]) by smtp.gmail.com with ESMTPSA id x10-20020a5d490a000000b00317ab75748bsm8627140wrq.49.2023.08.06.16.20.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Aug 2023 16:20:29 -0700 (PDT) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: git: 61f4c4d3dd38 - main - lib/libc/amd64/string: add strchrnul implementations (scalar, baseline) From: Jessica Clarke In-Reply-To: <202308061410.376EA6WM096467@gitrepo.freebsd.org> Date: Mon, 7 Aug 2023 00:20:18 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202308061410.376EA6WM096467@gitrepo.freebsd.org> To: Robert Clausecker X-Mailer: Apple Mail (2.3731.600.7) X-Rspamd-Queue-Id: 4RJwRN3Yyyz3P19 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] On 6 Aug 2023, at 15:10, Robert Clausecker wrote: >=20 > The branch main has been updated by fuz: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D61f4c4d3dd38c5b79e04fff1dedb0207= 1ebb33f2 >=20 > commit 61f4c4d3dd38c5b79e04fff1dedb02071ebb33f2 > Author: Robert Clausecker > AuthorDate: 2023-06-30 14:45:11 +0000 > Commit: Robert Clausecker > CommitDate: 2023-08-06 13:58:27 +0000 >=20 > lib/libc/amd64/string: add strchrnul implementations (scalar, = baseline) >=20 > A lot better than the generic (pre) implementaion. We do not beat = glibc > for long strings, likely due to glibc switching to AVX once the = input is > sufficiently long. X86-64-v3 and v4 implementations may be added = at a > future time. >=20 > os: FreeBSD > arch: amd64 > cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz > =E2=94=82 strchrnul_pre.out =E2=94=82 = strchrnul_scalar.out =E2=94=82 strchrnul_baseline.out = =E2=94=82 > =E2=94=82 sec/op =E2=94=82 sec/op vs base = =E2=94=82 sec/op vs base =E2=94=82 > Short 129.68=C2=B5 =C2=B1 3% 59.91=C2=B5 =C2=B1 1% = -53.80% (p=3D0.000 n=3D20) 44.37=C2=B5 =C2=B1 1% -65.79% (p=3D0.000 = n=3D20) > Mid 21.15=C2=B5 =C2=B1 0% 19.30=C2=B5 =C2=B1 0% = -8.76% (p=3D0.000 n=3D20) 12.30=C2=B5 =C2=B1 0% -41.85% (p=3D0.000 = n=3D20) > Long 13.772=C2=B5 =C2=B1 0% 11.028=C2=B5 =C2=B1 0% = -19.92% (p=3D0.000 n=3D20) 3.285=C2=B5 =C2=B1 0% -76.15% (p=3D0.000 = n=3D20) > geomean 33.55=C2=B5 23.36=C2=B5 -30.37% = 12.15=C2=B5 -63.80% >=20 > =E2=94=82 strchrnul_pre.out =E2=94=82 = strchrnul_scalar.out =E2=94=82 strchrnul_baseline.out = =E2=94=82 > =E2=94=82 B/s =E2=94=82 B/s vs = base =E2=94=82 B/s vs base = =E2=94=82 > Short 919.3Mi =C2=B1 3% 1989.7Mi =C2=B1 1% +116.45% = (p=3D0.000 n=3D20) 2686.8Mi =C2=B1 1% +192.28% (p=3D0.000 n=3D20) > Mid 5.505Gi =C2=B1 0% 6.033Gi =C2=B1 0% +9.60% = (p=3D0.000 n=3D20) 9.466Gi =C2=B1 0% +71.97% (p=3D0.000 n=3D20) > Long 8.453Gi =C2=B1 0% 10.557Gi =C2=B1 0% +24.88% = (p=3D0.000 n=3D20) 35.441Gi =C2=B1 0% +319.26% (p=3D0.000 n=3D20) > geomean 3.470Gi 4.983Gi +43.62% = 9.584Gi +176.22% >=20 > For comparison, glibc on the same machine: >=20 > =E2=94=82 strchrnul_glibc.out =E2=94=82 > =E2=94=82 sec/op =E2=94=82 > Short 49.73=C2=B5 =C2=B1 0% > Mid 14.60=C2=B5 =C2=B1 0% > Long 1.237=C2=B5 =C2=B1 0% > geomean 9.646=C2=B5 >=20 > =E2=94=82 strchrnul_glibc.out =E2=94=82 > =E2=94=82 B/s =E2=94=82 > Short 2.341Gi =C2=B1 0% > Mid 7.976Gi =C2=B1 0% > Long 94.14Gi =C2=B1 0% > geomean 12.07Gi >=20 > Sponsored by: The FreeBSD Foundation > Approved by: mjg > Differential Revision: https://reviews.freebsd.org/D41333 > --- > lib/libc/amd64/string/Makefile.inc | 1 + > lib/libc/amd64/string/strchrnul.S | 167 = +++++++++++++++++++++++++++++++++++++ > 2 files changed, 168 insertions(+) >=20 > diff --git a/lib/libc/amd64/string/Makefile.inc = b/lib/libc/amd64/string/Makefile.inc > index 1bfefa7be98c..b5260cfd78d1 100644 > --- a/lib/libc/amd64/string/Makefile.inc > +++ b/lib/libc/amd64/string/Makefile.inc > @@ -8,6 +8,7 @@ MDSRCS+=3D \ > memmove.S \ > memset.S \ > strcat.S \ > + strchrnul.S \ > strcmp.S \ > strlen.S \ > stpcpy.S > diff --git a/lib/libc/amd64/string/strchrnul.S = b/lib/libc/amd64/string/strchrnul.S > new file mode 100644 > index 000000000000..6d22f31850f8 > --- /dev/null > +++ b/lib/libc/amd64/string/strchrnul.S > @@ -0,0 +1,167 @@ > +/*- > + * Copyright (c) 2023 The FreeBSD Foundation > + * > + * This software was developed by Robert Clausecker > + * under sponsorship from the FreeBSD Foundation. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above = copyright > + * notice, this list of conditions and the following disclaimer in = the > + * documentation and/or other materials provided with the = distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ''AS IS'' = AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, = THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR = PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE = LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE = GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS = INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN = CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN = ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF > + * SUCH DAMAGE > + */ > + > +#include > + > +#include "amd64_archlevel.h" > + > +#define ALIGN_TEXT .p2align 4,0x90 # 16-byte alignment, nop-filled > + > + .weak strchrnul > + .set strchrnul, __strchrnul > + > +ARCHFUNCS(__strchrnul) > + ARCHFUNC(__strchrnul, scalar) This line specifically is using spaces not a tab for indentation. Jess