From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5AA4DA0556; Thu, 26 May 2022 17:28:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E9ACD40151; Thu, 26 May 2022 17:28:09 +0200 (CEST) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id 619F840150 for ; Thu, 26 May 2022 17:28:09 +0200 (CEST) Received: by mail-pj1-f46.google.com with SMTP id m14-20020a17090a414e00b001df77d29587so4715343pjg.2 for ; Thu, 26 May 2022 08:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CRN8gq/lYZT6EAjmIS01Pte+3/FbikYGU0Fm9RuveWE=; b=2zvKr5VZ2G/8BQbcNCyEazG0ZAbmXrcSkIlm0EYdiwmWE5ZZGG9vYp7NQhRT97NLyD ppeGLbxFgr3JE5Ffkom9Mdm+1ULIaUZydMNnbuV2IS4xVR+QPs1vb07snnME9ncoRn0r PUulhqtk5egPPUKS8pW1k/BFmBeblQlOKprk2zxTw/+UY5RhqKvu+ff/Yvc6/HOlqktx GF9xpfh2fW+sgFXAEDXuJ+ZxeObBrTb3hNYX55aMlI6s6OE0VdsxDcH14XbUTpN4KMMv Z3fX4zzUZn9tQaP9KpPn/7KMdA7o5cSOUPgyuj5GtIAPbsMmwB9uCmO2M/MiDs/orJD8 ScoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CRN8gq/lYZT6EAjmIS01Pte+3/FbikYGU0Fm9RuveWE=; b=EvlF2zdLhy5TXRj0eOQbhpWdZ98x+6PRUzTOdRYMJjN8rOy2mJRxoQE91WM23c7IVV kwYOdsrk3xOHzu9BSXTzzIE+uKTI+o5PCR/sOdvvH2lcuznLNqSSEba94TNOkzH17+F8 j/o40T8r9k0q/aqP3hH37b1YecZqe5GnHFBQabNzuvrI3uOZj1pNL5QJwJ0RTZqhSQ6B cUnyVWk6qkSfRd9dxbbDfbOxlsdlRVwl576vwGbbpAqYQLAUi9NRothkeaVHmYKcYyIY HVabyDqLV5uUHThGoBL49AEufRGhR8eSUv+oi0VGmyd+ySlisM5b6wwkiKcbGLJtQXRy tauA== X-Gm-Message-State: AOAM531BO8sHHF2TsyewCzj7eiIkJImFp4Er035l7v56J780jT61eoYG R1vj0mis2VPjX0lhv4PuIc0I2g== X-Google-Smtp-Source: ABdhPJz/Dp9Zv7dEISC5km3aMzGyc75/nl2FiqZKZgv5ZXGFhhEgW7bOYHX1BDgsfodnnTs6+6ioPw== X-Received: by 2002:a17:90a:62cb:b0:1dd:2ddd:ba8c with SMTP id k11-20020a17090a62cb00b001dd2dddba8cmr3223788pjs.226.1653578888555; Thu, 26 May 2022 08:28:08 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q22-20020a056a00089600b00518c3307266sm1673633pfj.170.2022.05.26.08.28.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 08:28:08 -0700 (PDT) Date: Thu, 26 May 2022 08:28:05 -0700 From: Stephen Hemminger To: Mattias =?UTF-8?B?UsO2bm5ibG9t?= Cc: dev@dpdk.org, Mattias =?UTF-8?B?UsO2bm5ibG9t?= , Ray Kinsella Subject: Re: [PATCH v4 1/3] random: add rte_drand() function Message-ID: <20220526082805.333892a1@hermes.local> In-Reply-To: <84afee2e-fa4c-faf1-d046-febb0ae77c09@lysator.liu.se> References: <20220524184623.480646-1-stephen@networkplumber.org> <20220525203123.277180-1-stephen@networkplumber.org> <20220525203123.277180-2-stephen@networkplumber.org> <84afee2e-fa4c-faf1-d046-febb0ae77c09@lysator.liu.se> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, 26 May 2022 15:20:29 +0200 Mattias R=C3=B6nnblom wrote: > > +#else > > + /* Slower method requiring floating point divide > > + * =20 >=20 > Do you know how much slower? I ran rand_perf_test on two of my systems. >=20 > AMD 5900X Pi4 (ARM Cortex-A72) > IEEE754 version 12 1.19 > Non-IEEE754 version 11 1.16 > Naive version* 24 1.16 >=20 > * (double)rte_rand() / (double)UINT64_MAX >=20 > Numbers are TSC cycles/op. >=20 > Surprisingly, it seems like the IEEE754 version is slower on both of=20 > these machines. >=20 > Do you have a machine (or a different use case) where the supposedly=20 > more optimized version actually runs faster? The direct method is based off the concept used by glibc and others and the divide (including spelling error) are from FreeBSD. Be careful with micro benchmarks. A better one would be do rte_drand() compared with something to check whether it is in range.