Message ID | 20240909162327.3163100-1-visitorckw@gmail.com |
---|---|
Headers |
Return-Path: <libc-alpha-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 94EB9385DDD4 for <patchwork@sourceware.org>; Mon, 9 Sep 2024 16:24:15 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 2E5CD3858432 for <libc-alpha@sourceware.org>; Mon, 9 Sep 2024 16:23:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2E5CD3858432 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 2E5CD3858432 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725899023; cv=none; b=T9DVredGw+RA5q10KsCFY/gB62T5IrlqqrGg2zw36RF5HMZ0JG/bEBUP208uNk5Q0i/cJu02Vvl1A1NUIs0FC1q+z0uAMUGYimS/wxMzV6imTdstqYmxA9J2DtcwwX9nY9dPmx0zmFvbLOClIlXEHRG/6pCCFHE5gW/C74hlazo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725899023; c=relaxed/simple; bh=NYyHAT1NC8gNXd8jJw4V+1AYxRxSecViWPZw7CNhlxI=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Q/6/FyaPimQqaZ6bPv+JgpYX8m1OezkvgUjUDhaD5gqRhd9MjXuWZVawc5Fok4vO+3PG2YdawlvrtBZl5LC/0P1DZOGS3nV4FmUNUQFgIcmKS4uj7S6vjimEb+JemoHr7eCCoFpl5Zvf3orXvZbaHPYyfbIrkzwb1Y02nCXGzdI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-206b9455460so37060415ad.0 for <libc-alpha@sourceware.org>; Mon, 09 Sep 2024 09:23:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725899019; x=1726503819; 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=qWs7fTUmnXGdDNbX+I09x5aEUlk0B6KBp2/DryfEQN8=; b=gAg1JS9om8Hk6TW7hMWVk5La8wmBv3vEhw1sGs9/CAgq+tY61pJwXVmUnHk82SR8o0 W64mlF2dm1S/iroUTyVEzCJrKLiPF3vWGSRbGT0ouRDzCAC4V8FQ3tYbQqpV3qcwT1Aq 5RnpXxazXd/QyDBmtK/joUL4zULtthrbFMzxQwyLoWxktoc947N53gHKzKyVJn+v1BB3 jeJmzrylvnJq4KgQtbfzu2TTmsWaSpg3KXvMx3CTjvYC7D9YtFHzrmalROedcj3+ob4G utMLGeR6TwUFhmvY27zpGSL9pGQhunoxYyFvgVdNX7xRypOSQg3FgJ90TAaGM4a5al6s gnaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725899019; x=1726503819; 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=qWs7fTUmnXGdDNbX+I09x5aEUlk0B6KBp2/DryfEQN8=; b=C1Ej36IwJhRps0sW/IwwGVMK0LWWZ0Yvoe0AGr7AkmosNjNKfhpuap6Qexseh+8hZC qrAoveSb2SSXehBww8aC13OVthN0JV49m6IiIuQWe1KHPWz3dX6xXKvTc4PoRjqg0AIX Q+nrDJr+vPb6rMUPuzUQYP8JmcLACKfgqLu91rwxygX4bM2n5Ge9PDxHLvFCdFzby5yy AfIVqa2wOuGgQryB033czcf08Esw7DTRqmDYmWhuUOCvqP9TTRxb226E/OxK/mxE8lzh +fLhWHghvVV80wldrH0x5NLXXZhWPLSGeyWUfdgQAJTCWP8PRtNI6SympKW5F/CBNaXw qlMw== X-Gm-Message-State: AOJu0YzDD64DUoYeiwEfIVYCN3tJqu/6c/FO9pjS77rXQf2bqzElev3N 83VxWsa9e26FxOMbRFz21HZSKu7QeHmasbZo85ZMiH+hoew1OeZ2L5XZIw== X-Google-Smtp-Source: AGHT+IE1QY3WAX5K/6R6Req4mF+vRXa9tHONUDMmz8BwxCv+VcPvLoFNqvJz2dDTlqDggZ8aEOhXlw== X-Received: by 2002:a17:902:f541:b0:206:b618:1d96 with SMTP id d9443c01a7336-207434debd6mr2169585ad.0.1725899018453; Mon, 09 Sep 2024 09:23:38 -0700 (PDT) Received: from visitorckw-System-Product-Name.. ([140.113.216.168]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f36356sm35862455ad.290.2024.09.09.09.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 09:23:37 -0700 (PDT) From: Kuan-Wei Chiu <visitorckw@gmail.com> To: libc-alpha@sourceware.org Cc: goldstein.w.n@gmail.com, jserv@ccns.ncku.edu.tw, Kuan-Wei Chiu <visitorckw@gmail.com> Subject: [PATCH v7 0/2] Optimization and benchmarking of bsearch() Date: Tue, 10 Sep 2024 00:23:25 +0800 Message-Id: <20240909162327.3163100-1-visitorckw@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 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 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 <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org |
Series |
Optimization and benchmarking of bsearch()
|
|
Message
Kuan-Wei Chiu
Sept. 9, 2024, 4:23 p.m. UTC
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 v7: - Drop 'nmemb' field and add 'element-size' field. Changes in v6: - Add 'nmemb' field to the 'results' array. Changes in v5: - Move 'array-size', 'key-pattern', and 'contained' fields into the 'results' array. - Add 'simple' field to the 'results' array. - Add tests for 'key-pattern' = 'descending' and 'contained' = 'no'. - Drop the full benchmark log from the commit message as it is becoming too verbose. 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 | 137 +++++++++++++++++++++++++++++++++++++ bits/stdlib-bsearch.h | 20 +++--- 3 files changed, 147 insertions(+), 11 deletions(-) create mode 100644 benchtests/bench-bsearch.c