From patchwork Sat Sep 18 21:39:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 1529743 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=cl/Mu54E; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4HBkkh6DnQz9sW5 for ; Sun, 19 Sep 2021 07:40:12 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 95049385803B for ; Sat, 18 Sep 2021 21:40:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95049385803B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1632001209; bh=8EWPvHYBwtqV8fhw2pzw9OF3FU7ydffJ08DZ5qoSDXw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=cl/Mu54EXkic4HUZKdI+v+LquYhlYz3o+ilr7ueukkK0aQ7fYFTZEiEzTKbo+sMoJ CZk+mC9YiPFrgV7Lbfuf/peQTT/M9F+LN2Y0Ig7HHn+c4UMgxVV3JlOMJJgS7VNlED Gpt+U+KeWlaYr1H9qW4DESkjrngsjrbItiYRGVOU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by sourceware.org (Postfix) with ESMTPS id 68893385840D for ; Sat, 18 Sep 2021 21:39:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 68893385840D Received: by mail-io1-xd2e.google.com with SMTP id s20so8231166ioa.4 for ; Sat, 18 Sep 2021 14:39:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8EWPvHYBwtqV8fhw2pzw9OF3FU7ydffJ08DZ5qoSDXw=; b=d/I73f2GERTs64HdfAhFkQbMzbH+lNudMLu8KuAUEMu7sN2I1csI7NK0ImZPKMrJKR vActvGshxFTRk6FlL+Y9pWwk16OOnis9B5zKyYRpNIcD2/ywY6YQ8scLPTisZwFUXjoU dal/SY58Zv+a/s+zdpbzKixnpzdtCI4W9ObM62chqzddwD6mDMmcRFkG7rn6WiwqY0Sz +9aEAR8B6bdu5sBqp4dleKeWojMRcA1pK2UeMp7NtlNuT568POdgmlL99eJ7aMKuIMxK vaPiga67vAZQrs1xrSvL4nUBoo4v+Pbdi2fbUAAnOCfdJNDJMovH9lXdMoHBPtbGg7Hd yn+g== X-Gm-Message-State: AOAM5304sHpNVvMNjCSbQ1CwuYvZwj6xA5FFr2TVRS6QU0rrpXi/8Nrk qFhITQnwRDu62KIui6sR8fiEaDLIAdM= X-Google-Smtp-Source: ABdhPJzbgl0ifPBLx0/UKQYB1BHBVdyIzZyPzbDopzcCmtSLcEWPlrLnVdRhpG6UimMag8YK8BzaVQ== X-Received: by 2002:a02:620e:: with SMTP id d14mr13687997jac.91.1632001194722; Sat, 18 Sep 2021 14:39:54 -0700 (PDT) Received: from localhost.localdomain (mobile-130-126-255-38.near.illinois.edu. [130.126.255.38]) by smtp.googlemail.com with ESMTPSA id s5sm6048022ilq.59.2021.09.18.14.39.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 14:39:54 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v1] benchtests: Improve reliability of memcmp benchmarks Date: Sat, 18 Sep 2021 16:39:47 -0500 Message-Id: <20210918213947.2426144-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Noah Goldstein via Libc-alpha From: Noah Goldstein Reply-To: Noah Goldstein Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" No bug. Remove reallocation of bufs between implementation tests. Move initialization outside of foreach implementation test loop. Increase iteration count. Generally before this commit was seeing a great deal of variability between runs. The goal of this commit is to make the results more reliable. Benchtests build and bench-memcmp succeeding. Reviewed-by: H.J. Lu --- benchtests/bench-memcmp.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/benchtests/bench-memcmp.c b/benchtests/bench-memcmp.c index 744c7ec5ba..0d6a93bf29 100644 --- a/benchtests/bench-memcmp.c +++ b/benchtests/bench-memcmp.c @@ -63,7 +63,7 @@ static void do_one_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s1, const CHAR *s2, size_t len, int exp_result) { - size_t i, iters = INNER_LOOP_ITERS8; + size_t i, iters = INNER_LOOP_ITERS_LARGE; timing_t start, stop, cur; TIMING_NOW (start); @@ -103,20 +103,19 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len, json_attr_uint (json_ctx, "result", (double) exp_result); json_array_begin (json_ctx, "timings"); - FOR_EACH_IMPL (impl, 0) - { - s1 = (CHAR *) (buf1 + align1); - s2 = (CHAR *) (buf2 + align2); + s1 = (CHAR *)(buf1 + align1); + s2 = (CHAR *)(buf2 + align2); - for (i = 0; i < len; i++) - s1[i] = s2[i] = 1 + (23 << ((CHARBYTES - 1) * 8)) * i % MAX_CHAR; + for (i = 0; i < len; i++) + s1[i] = s2[i] = 1 + (23 << ((CHARBYTES - 1) * 8)) * i % MAX_CHAR; - s1[len] = align1; - s2[len] = align2; - s2[len - 1] -= exp_result; + s1[len] = align1; + s2[len] = align2; + s2[len - 1] -= exp_result; + FOR_EACH_IMPL (impl, 0) + { do_one_test (json_ctx, impl, s1, s2, len, exp_result); - alloc_bufs (); } json_array_end (json_ctx);