From patchwork Thu Aug 16 08:43:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 958149 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-95297-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="FwqSSi7k"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41rfyD1XSvz9s3C for ; Thu, 16 Aug 2018 18:44:03 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=atSHQWYGxnhQxfkcFifKC5sck5tadWI iDEs79hcQZCWdGvV9xnlBV/WouKa6LiIRKhdyK/2TYa0Z6Ar5TXyVbucEvIdqZd7 SoIJUEGa3lHEtcf5CrboA2WvmvZb/hqaW0/nTpwDkD5JQoGjYlE4Y/c4PknjwJ0b n8JHk3eggX+0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=8wzlShQHMdhWGEyGyUDSoyF1z6k=; b=FwqSS i7kWPjcvWnB6BuOCglaNWRgrB3IDn4KnzWCM/viW3uuxBRn+1aq1Zq1mzpJHmsSS dn+QdDMQ8AtgDVC4iLLs4illo6ly8UEMjp1WQP809aSnu8RGfqRuEGyQZhwEaN4G TTlJfsDQGAWZiWNwpD8iq5EITu5HYGLWViwrt0= Received: (qmail 29358 invoked by alias); 16 Aug 2018 08:43:49 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 29285 invoked by uid 89); 16 Aug 2018 08:43:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_NEUTRAL autolearn=ham version=3.3.2 spammy= X-HELO: homiemail-a52.g.dreamhost.com From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Subject: [COMMITTED] Reallocate buffers for every run in strlen Date: Thu, 16 Aug 2018 14:13:32 +0530 Message-Id: <20180816084332.8469-2-siddhesh@sourceware.org> In-Reply-To: <20180816084332.8469-1-siddhesh@sourceware.org> References: <20180816084332.8469-1-siddhesh@sourceware.org> Try and avoid influencing performance of neighbouring functions. --- ChangeLog | 3 +++ benchtests/bench-strlen.c | 17 ++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec444a339e..cd60ef8399 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-08-16 Siddhesh Poyarekar + * benchtests/bench-strlen.c (do_test): Allocate buffers before + every strlen call. + * benchtests/bench-strlen.c: Print performance numbers in json. 2018-08-16 Rajalakshmi Srinivasaraghavan diff --git a/benchtests/bench-strlen.c b/benchtests/bench-strlen.c index 6782215e7e..576849400f 100644 --- a/benchtests/bench-strlen.c +++ b/benchtests/bench-strlen.c @@ -96,12 +96,6 @@ do_test (json_ctx_t *json_ctx, size_t align, size_t len) if (align + sizeof(CHAR) * len >= page_size) return; - CHAR *buf = (CHAR *) (buf1); - - for (i = 0; i < len; ++i) - buf[align + i] = 1 + 11111 * i % MAX_CHAR; - buf[align + len] = 0; - json_element_object_begin (json_ctx); json_attr_uint (json_ctx, "length", len); json_attr_uint (json_ctx, "alignment", align); @@ -109,7 +103,16 @@ do_test (json_ctx_t *json_ctx, size_t align, size_t len) FOR_EACH_IMPL (impl, 0) - do_one_test (json_ctx, impl, (CHAR *) (buf + align), len); + { + CHAR *buf = (CHAR *) (buf1); + + for (i = 0; i < len; ++i) + buf[align + i] = 1 + 11111 * i % MAX_CHAR; + buf[align + len] = 0; + + do_one_test (json_ctx, impl, (CHAR *) (buf + align), len); + alloc_bufs (); + } json_array_end (json_ctx); json_element_object_end (json_ctx);