From patchwork Wed Sep 4 16:01:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 1980915 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=KyoPhpsJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WzS1S5Z80z1yXY for ; Thu, 5 Sep 2024 02:02:20 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BFC88385DDC1 for ; Wed, 4 Sep 2024 16:02:17 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id A7EF53858406 for ; Wed, 4 Sep 2024 16:02:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A7EF53858406 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A7EF53858406 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725465724; cv=none; b=xWYBGfTBF10QynPCrOTIHvOmLLtLThQoKXAFR6wpKeVGJFD7NvHsZWmTIPnX/1+VqasMluXrZHNgsh7ahtIGgVTPe405K1HcjTBUl1j1uVP7KNADfRac8c4RBWiLxXKVflzKGYLvvJ1yoZHhwfdvJTxXTNVsZGBd/Db/0ftTNjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725465724; c=relaxed/simple; bh=yoreHEbRfh4BE8N69zITLYeCIlohvgSwRN5IC+AuHgg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=qSUTCajDfDFT0Gj1I82HYeS4fJEAB/huIB1Xy6NQYhRl6vg4jVNATh+o6A8O2rGZwTTBae/UZeRPaq5OsIG/McLP/x9nHjX0MWGgQfo/V5QLB0951cMa3C1nevyrsCcI3vEFKdwvsP7+W0BXt8cEgkxYHr086w3uMLL7vK1OKUY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-205909afad3so27859905ad.2 for ; Wed, 04 Sep 2024 09:02:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725465721; x=1726070521; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QNd/1BeXP9SQCfKRLmQPhRObd2qoHA8HUOdETQ3FGhA=; b=KyoPhpsJgCV9GIU0zgvQLUnI07DZfC+QIOK+znMyP4xmDpSRtZ1sW/wZX3fBYxt7X5 lfWGm6RzrVl4JXI/6+id2vNV/LWBzuFqep1BViAO31isDjdxpJGGjazC9xN62MqjVSBV xGE1qMBHAYWL9qj/MOIP5xHaU3Oi4F0RoDhj9YayllngiKQaE8V4cq7feo3WayGF5o0K 5BHtGqaLrfonPeolXKBSHoRkWXJ4i2DhQGbdnNONJzBUa8trG4uIu0DTtRl6P//wPrZg 7nxnwcjXNn+a36PIhDCMSafXmGxwqm9VFzJuyGXmJF5v2TRWeJdlyb/SGTDLSCDaNZjF TjRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725465721; x=1726070521; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QNd/1BeXP9SQCfKRLmQPhRObd2qoHA8HUOdETQ3FGhA=; b=OUI5IeUvxN5adXWzBC1LsMSqU8lFBl1jzrnzYxAyujMQjeWgXgx5WRhJhCJHE4O5hj HSvRgJFjkfPdKnG9iM1bkXcahrUFwLAD5Ii+HfSdFZ1qvcO9k3tyV/otwkU4C2AW0MYD 5+DlmRzjEDQSw4pMVi28l3Br21sB14DIimyi9GK4J4CmbltsYS/LmlpCzFcno0ynl4Y4 0FhfJxZ/ulUWBip8wwvkWA5jUVi/Cqc7kCFD01T31QdBGTfT+9pRdF4sxRTLapv5tWWS 1UukIFGA8ttbQT/h5YiWuyNCbl3gu4KMdOkdV/p1jZwRZIaxbP7FcwfFn/wG3KoZhkv0 OsIA== X-Gm-Message-State: AOJu0YwT6UNbX8zDOiqRyqw0lbh9kZuDQOGiP31eTt2/Du3IMIGXPxoy O9ozMd/phoKdVMygcYttK6RXrRNRIFHKL8Kn1ElN0BaJ/AmlX1rpI96J/w== X-Google-Smtp-Source: AGHT+IFwrKN1Sqc3I8kIyBvQPfa8PzoAqkmZNa+m4b1uSMbo+gbaHW51KCfY3A0HTCedf27guPZ4LQ== X-Received: by 2002:a17:902:e745:b0:206:c2e3:68f3 with SMTP id d9443c01a7336-206c2e36bfemr18243635ad.10.1725465720811; Wed, 04 Sep 2024 09:02:00 -0700 (PDT) Received: from visitorckw-System-Product-Name.. ([140.113.216.168]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-206aea38c91sm15193565ad.169.2024.09.04.09.01.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:01:59 -0700 (PDT) From: Kuan-Wei Chiu To: libc-alpha@sourceware.org Cc: goldstein.w.n@gmail.com, jserv@ccns.ncku.edu.tw, Kuan-Wei Chiu Subject: [PATCH v4 0/2] Optimization and benchmarking of bsearch() Date: Thu, 5 Sep 2024 00:01:38 +0800 Message-Id: <20240904160140.2743366-1-visitorckw@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org Hello, I have added a benchmark test for the bsearch() function and optimized its implementation to enhance its efficiency. Benchmark results on my x86 machine demonstrate that the new implementation reduces execution time by 15% compared to the previous version. Changes in v4: - Add three fields: "array-size," "key-pattern," and "contained" to benchmark json output. - Update the benchmark result format in commit messages. Changes in v3: - Sort the stdlib-benchset entries in Makefile to resolve CI failures. Changes in v2: - Add benchmark tests for the bsearch() function. - Update the commit message to reflect the new benchmark results. Regards, Kuan-Wei Kuan-Wei Chiu (2): benchtests: Add benchmark test for bsearch Optimize bsearch() implementation for performance benchtests/Makefile | 1 + benchtests/bench-bsearch.c | 114 +++++++++++++++++++++++++++++++++++++ bits/stdlib-bsearch.h | 20 +++---- 3 files changed, 124 insertions(+), 11 deletions(-) create mode 100644 benchtests/bench-bsearch.c