From owner-svn-src-all@FreeBSD.ORG Sat May 4 16:42:20 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CD8FA645; Sat, 4 May 2013 16:42:20 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [IPv6:2a00:1450:400c:c00::231]) by mx1.freebsd.org (Postfix) with ESMTP id BE167335; Sat, 4 May 2013 16:42:19 +0000 (UTC) Received: by mail-wg0-f49.google.com with SMTP id j13so2387120wgh.4 for ; Sat, 04 May 2013 09:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=9MgvaCdM+b9S1BDRQlzN5s3o/8Td0goZeDVEXaWysgA=; b=HPXyNvOsWbVKahuOxjd8a7ZwTKk+RYLbxNsUIJUvUKp55wuCwBXUc4uVPWM9sB1ZW7 yiumbE+Qay6mi5ShkvBokGx0acqvMIkLfoHCRCCzCRtPQxNovsIM8Bu1miSkuNyI0hzH vwXYcfl46SFrjISyYjlAO1DQMRqwfccQLY9tjvojKiEN93YCnBvO1Oe+MI9N93SYtQP4 FSXIX8Ww3JUE/d/qea5h21b/ozVLDctxJopnB1eei5azajVsL36mA7aQO1dEr2COyUNP OxV9uoUYajAK0oVqV2nWQrVQlG4YS21DqebIzZdBt63MIgegeOj0WHAqHZVAbUBqmnqy 0yGQ== MIME-Version: 1.0 X-Received: by 10.194.78.137 with SMTP id b9mr18876809wjx.10.1367685738781; Sat, 04 May 2013 09:42:18 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.194.29.199 with HTTP; Sat, 4 May 2013 09:42:18 -0700 (PDT) In-Reply-To: <51851969.6020802@freebsd.org> References: <201305031552.r43FqiPN024580@svn.freebsd.org> <5183E899.4000503@freebsd.org> <20130503195540.GA52657@stack.nl> <5184ED7E.3040703@freebsd.org> <51851969.6020802@freebsd.org> Date: Sat, 4 May 2013 20:42:18 +0400 X-Google-Sender-Auth: NXXOKYIQf5Qaty25auKGgsY3GTk Message-ID: Subject: Re: svn commit: r250215 - stable/9/lib/libc/locale From: Sergey Kandaurov To: Andrey Chernov Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org, Jilles Tjoelker X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 May 2013 16:42:20 -0000 On 4 May 2013 18:21, Andrey Chernov wrote: > On 04.05.2013 16:03, Sergey Kandaurov wrote: >>> BTW, I don't run tests and look in asm code for sure, but it seems >>> property[0] == p[0] is unneeded because almost every compiler tries to >>> inline strcmp(). >> >> Doesn't seem so (in-lining), see below. > > Yes, system's GNU cc don't inline strcmp() but inlines memcmp(): > repz > cmpsb > I don't have clang nearby right now to test what it does. I've checked gcc46 and clang3.2, and they behave similarly (poor). It's worth to note that inlined memcmp didn't help with performance relative to strcmp(). note2 - it's surprising that only base gcc inlined memcmp. This explains the difference between base gcc and {gcc46, clang} in the table below. 1 - base gcc 4.2 2 - gcc46 3 - base clang 3.2 a - if (property[0] == p[0] && strcmp(property, p) == 0) b - if (property[0] == p[0] && memcmp(property, p, *len2) == 0) c - if (memcmp(property, p, *len2) == 0) Time spend for 2097152 wctype() calls for each of wctype property 1a 2a 3a 1b 2b 3b 1c 2c 3c alnum 0.034 0.036 0.034 0.049 0.071 0.073 0.046 0.068 0.069 alpha 0.045 0.049 0.046 0.111 0.156 0.158 0.107 0.153 0.154 blank 0.037 0.041 0.038 0.053 0.075 0.079 0.153 0.224 0.223 cntrl 0.039 0.044 0.042 0.058 0.078 0.081 0.206 0.300 0.301 digit 0.039 0.044 0.043 0.059 0.080 0.085 0.259 0.378 0.378 graph 0.043 0.049 0.050 0.061 0.082 0.087 0.313 0.455 0.455 lower 0.044 0.049 0.051 0.062 0.085 0.090 0.365 0.532 0.533 print 0.048 0.054 0.059 0.067 0.088 0.092 0.419 0.610 0.610 punct 0.060 0.067 0.103 0.127 0.183 0.211 0.477 0.692 0.692 space 0.053 0.059 0.067 0.072 0.092 0.097 0.525 0.764 0.765 upper 0.054 0.059 0.068 0.074 0.094 0.100 0.578 0.841 0.842 xdigit 0.060 0.066 0.077 0.079 0.099 0.106 0.635 0.922 0.985 ideogram 0.068 0.074 0.084 0.087 0.089 0.094 0.695 0.986 0.985 special 0.098 0.104 0.113 0.169 0.210 0.212 0.753 1.116 1.118 phonogram 0.136 0.156 0.187 0.240 0.285 0.325 0.815 1.181 1.183 rune 0.064 0.070 0.087 0.099 0.104 0.113 0.842 1.293 1.283 -- wbr, pluknet