From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24280 invoked by alias); 10 Sep 2014 18:09:51 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 24262 invoked by uid 89); 10 Sep 2014 18:09:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com From: "Wilco Dijkstra" To: "'Florian Weimer'" Cc: References: <001301cfcd0a$f0b62670$d2227350$@com> <54108BB0.90902@redhat.com> In-Reply-To: <54108BB0.90902@redhat.com> Subject: RE: [PATCH] Improve performance of strncpy Date: Wed, 10 Sep 2014 18:09:00 -0000 Message-ID: <001601cfcd22$67546500$35fd2f00$@com> MIME-Version: 1.0 X-MC-Unique: 114091019094604701 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2014-09/txt/msg00197.txt.bz2 > Florian Weimer wrote: > On 09/10/2014 05:21 PM, Wilco Dijkstra wrote: > > Yes, you're right, I timed it and there is actually little difference, = while > > the code is now even simpler. New version below (not attaching results = in bad > > characters due to various mail servers changing line endings). > > > > OK for commit? >=20 > I think you could simplify it down to strnlen, memcpy, and memset. I'll have a go at that in a follow-on patch. Something similar is possible = with strcpy and strncat which currently do byte-by-byte copies as well. Simplify= ing=20 the code is certainly a nice benefit besides the performance gain on longer strings. Wilco