From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id A29B53858D20 for ; Tue, 2 Apr 2024 02:28:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A29B53858D20 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 A29B53858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712024900; cv=none; b=LaRIvcx02ywq86JwdufIJfl/btVHPNUIjSOgaSiHAGmFqpvacI3xUwTZKZtEtNEPinrV9G3sH4hgJn65pz+uZjV1LHt/lNv/gHjlf8/XImmOhAme8N4yZjWsj1fs8R7msTNYqgKXmuurm6yIyFKNz4mrIWncmvTH7HtaYutjHN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712024900; c=relaxed/simple; bh=JD91ZeOVcP7SLfzK6ewPf9HDq7e8qFtHfOdboXOEc4g=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=kdpGpCbKF6nx08jcEsI+alfk7QT+8uUdUasMG/aJE5y0HhzEZ+cTaFHbXemF1EOXRsjTr1mQtqrzbbEvum6IPTk3B2+QrV20IPBo2AQpVHh8SihKcN3Cq4/7emSvVCgyp+ERL7HieU9pEOLziDt8ulrunKacd0Uxy+nvi+Gm4NE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2a226f8e44aso1239004a91.0 for ; Mon, 01 Apr 2024 19:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712024896; x=1712629696; darn=sourceware.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=aRn81e82FjNm2+blRmiFBO2uKcn0Sg0+GkiXdfAn2eo=; b=hH54dx2sSEk2rl/Wrjv+uaMuJ5P38V5cTYnfAyNz5OMLtA9+8tC9DQuxesFR631zwL I3SXmcJ8MvL37vgskvO7cXKSw6uyLmP/S1Tqnp/Wn+BPte0vcpyoP47l4+7kgyIbn1XD CPYExZlcmvOQi9wxh0mAVJT+3re4er7dq5E7vvLd4GdfKVsDofA+bbnQuXUXSWc/2oqt frZicWfeQy0fEXuC3t8e7a7Z9I1QencUuy1iD6APR8fTEakYJ9CWTzm9T6YHPEbZh4vW 2OAW0OXltTi/+skyY4etDMDC4KCAE7hfsQyn+FVzbgWbEOpWPYBY6HGPgK/ZNs9ABdoG ObpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712024896; x=1712629696; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aRn81e82FjNm2+blRmiFBO2uKcn0Sg0+GkiXdfAn2eo=; b=j8emfzUH04PVHLbTsoHCnvNdqhJmGamWlsik+89LN07lLmvcnYS+LwIHd240eYaUwN QVF0JS0irSJH2ckth1tIKsT7SRocWJW0+hHYZGmS1551uyatAozU1IQlFALxnxVeBwpi rvBQaiNU+2doxdIBs21O4KhtSY+kwrAPEjJO53kyyfuAZ17vwRTKalewH1lxki4NNbYS RiP7ExHMH4NTSH3FMB8a2tKSJXf9himil1mHKeu1H9BWGTAftyU19W73V8coNWYgk+Sx seufPmW0x1bZ65jBu7fvgc5xYafjw/jD8zqTp0XclAyAWCo0/wF8NgUzs0QML0XE3eNq X19w== X-Gm-Message-State: AOJu0YwlCRwOX5d/CpshvFjqVK6viYOq3EIpkvwdVOkzms27l1ZE18yJ V7MMeOWd2D98tkQmH1ijTfHFljZos8gLTw26SJoPhBN7Q4cRjyJDcFkH0QtBIJIMJk75p8HYETi e9QuUyYQBeDZYL49Xw/5+2zmboPDmkKZ2cElSsQ== X-Google-Smtp-Source: AGHT+IEA+R+Z4Iu1s/T6E17u9Ae6tfMMu4WC07ZOUFpwJIVv7QZSzwDVosrHvNLmzn0GqW0bgCCNyprVGtXx1svF6iM= X-Received: by 2002:a17:90a:be02:b0:2a2:72f:66a8 with SMTP id a2-20020a17090abe0200b002a2072f66a8mr8498061pjs.42.1712024896296; Mon, 01 Apr 2024 19:28:16 -0700 (PDT) MIME-Version: 1.0 References: <87plv91b22.fsf@oldenburg3.str.redhat.com> In-Reply-To: From: abush wang Date: Tue, 2 Apr 2024 10:28:05 +0800 Message-ID: Subject: Re: [PATCH] stdlib: reorganize stdlib Makefile routines by functionality To: Florian Weimer Cc: abushwang via Libc-alpha , adhemerval.zanella@linaro.org Content-Type: multipart/alternative; boundary="000000000000ca60d6061513db2b" X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,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 List-Id: --000000000000ca60d6061513db2b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Actually, not just d275970ab I found after a91bf4e0ff, there is also performance degradation on x86-64, even if this commit has nothing to do with lrand48. This is my test data: before a91bf4e0ff: Average time for lrand48: 1940 cycles after: Average time for lrand48: 5626 cycles It seems like there is a gradual performance degradation for lrand48. On Tue, Apr 2, 2024 at 10:17=E2=80=AFAM abush wang w= rote: > Yes=EF=BC=8Con x86-64. > I just compare the disassemble between d275970ab and before commit by > objdump. > And __drand48_iterate will be more long distance after d275970ab, so I > revert this > commit and found the performance will recover a little. > > Thanks, > abush > > > On Mon, Apr 1, 2024 at 9:12=E2=80=AFPM Florian Weimer wrote: > >> * abush wang: >> >> > This is test: >> > ``` >> > uint64_t getnsecs() { >> > uint32_t lo, hi; >> > __asm__ __volatile__ ( >> > "rdtsc" : "=3Da"(lo), "=3Dd"(hi) >> > ); >> > return ((uint64_t)hi << 32) | lo; >> > } >> > >> > int main() { >> > const int num_iterations =3D 1; >> > uint64_t start, end, total_time =3D 0; >> > >> > start =3D getnsecs(); >> > for (int i =3D 0; i < num_iterations; i++) { >> > (void) lrand48(); >> > } >> > end =3D getnsecs(); >> > total_time +=3D (end - start); >> > >> > printf("Average time for lrand48: %lu cycles\n", total_time / >> num_iterations); >> > return 0; >> > } >> > ``` >> > before: >> > Average time for lrand48: 21418 cycles >> > >> > after: >> > Average time for lrand48: 9892 cycles >> >> Do you see this on x86-64? So this isn't a displacement range issue? >> >> It could be that this is a random performance change due to code >> alignment, and not actually caused by the direct call distance. >> >> Thanks, >> Florian >> >> --000000000000ca60d6061513db2b--