Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121050 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 15884 invoked from network); 12 Sep 2023 21:36:36 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Sep 2023 21:36:36 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F2DBD1804B0 for ; Tue, 12 Sep 2023 14:36:35 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 12 Sep 2023 14:36:35 -0700 (PDT) Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-1c504386370so4142048fac.1 for ; Tue, 12 Sep 2023 14:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694554594; x=1695159394; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=yg3bdXkbH3L+vzT7UDjN4asWl4SEPaaNply9v/lG6vg=; b=HAWzJIndWVotU6Zb9eXzXpgnjncmVhA9TYfweTKptETszYWT6tL+9GN5NASvt7BP+J 1TP+jpFwyAXmxSEx49xTvA9UON1ePQIizEGrd8VWUXB4J3cNrDBaeq/roEsRCbgu6zcm eHH+M6dPmZNOmt37+h/z3dkzM3WbC85OR+upB2mBB6EWT5YHTEJ7Ac67xMjN6GEOEVn6 e3aIG/4rTphIiWjY0yjbTwdvtsijtMJwcIeFrTKcUKVpGMD4yb+j3PFrXKnBr9QBItAI X5ZDrgM82XAg5AmXJqPQjS/FiDFtzJ1BeDPhKhMkqb+l5rpkYFMjtwyi114swxaXLvgB Tthg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694554594; x=1695159394; h=content-transfer-encoding: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=yg3bdXkbH3L+vzT7UDjN4asWl4SEPaaNply9v/lG6vg=; b=BQ8Rkyw39KHVia1I9NjpLpGVF26aaJh47Zy0C8xSta/Buj8f8ETQi/vKo9BLzs5Mc4 F2Fm2zxWPftLdOvTn6rL0sAQso4yxHFVLauv6VDGv30mntUVyyWjAWQ5k15/Gtg8XCfv M49/a5jv56SswvJMJEUFZ0ienJ8KOpqoLEkQpcoVddk3WrIm1L3dH9SJm77F543jke/5 aF/mz5vORY5yMXqSbmMJAfLKjWrsy0ezmvCnuZxEavKCitPUINLBN3R/xOpAlFthNQfK +QZSDmWIowLnHsK7m8ehnozoKM4LWwyX0cGps4c11gH3QTiEM70Fft+LHQaK+ZZ9PjeJ E3hQ== X-Gm-Message-State: AOJu0YxM2pjCJ2PtOVdVlQ9wNnhyppvSNY6Ld7NBpqV9JSw3F+oAySIf 1VpvzaZyPXoavRpB5dnwLhwlgcN/nplwYbnJilg= X-Google-Smtp-Source: AGHT+IH4C0TdRLDbjFIXLRUvqWJMtWI8Li8GnpaQYvjr3bFZFe02VYLEFo+r1S2pS/eUNe8PsCtijt75fZYR+T92RZg= X-Received: by 2002:a05:6870:3127:b0:1d0:e370:c151 with SMTP id v39-20020a056870312700b001d0e370c151mr582317oaa.53.1694554594539; Tue, 12 Sep 2023 14:36:34 -0700 (PDT) MIME-Version: 1.0 References: <076e8c8a-9f17-0163-acad-87df7f4302a1@bastelstu.be> <7da23206-9cd9-947d-fa19-645ae21923cb@bastelstu.be> In-Reply-To: <7da23206-9cd9-947d-fa19-645ae21923cb@bastelstu.be> Date: Tue, 12 Sep 2023 23:35:56 +0200 Message-ID: To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC: Increasing the default BCrypt cost From: divinity76@gmail.com (Hans Henrik Bergan) >you're also measuring the startup cost of PHP itself. yup correct >A simple microtime(true) benchmark loop as used with my test script should= be fine for ballpark estimates agreed >dwarfing the measurement overhead. wouldn't count out random cpu context switch/background noise completely, see my hyperfine benchmark for cost 13: > Range (min =E2=80=A6 max): 717.3 ms =E2=80=A6 754.5 ms 10 runs - over 10 runs, the fastest was 717ms and the slowest was 754ms, so background noise made at least 37ms difference there.. but yeah anyway, here's from your script: hanshenrik@jonathan-dayton:~$ time php bench.php Cost 8: 2.022854 total (0.020229 per hash) Cost 9: 4.176210 total (0.041762 per hash) Cost 10: 8.121596 total (0.081216 per hash) Cost 11: 16.919405 total (0.169194 per hash) Cost 12: 33.059071 total (0.330591 per hash) Cost 13: 66.761731 total (0.667617 per hash) Cost 14: 140.695820 total (1.406958 per hash) real 4m31.854s user 4m13.115s sys 0m2.168s hanshenrik@jonathan-dayton:~$ cat /proc/cpuinfo | head (...) model name : AMD Opteron(tm) Processor 4122 On Tue, 12 Sept 2023 at 18:01, Tim D=C3=BCsterhus wrote: > > Hi > > On 9/12/23 17:56, Hans Henrik Bergan wrote: > >> web hosters *love* their ancient hardware > > > > No kidding. dreamhost.com host over 1.5 million websites, presumably mo= st > > are on their "Shared Unlimited" package, which runs on > > AMD Opteron 4122, a high-end server CPU from 2010. > > Some benchmarks there: > > It appears your benchmarks are broken, because you're also measuring the > startup cost of PHP itself. You should see an approximate doubling in > time taken for each increase of the cost, but you have 122ms for 9 and > 166ms for 10. > > A simple microtime(true) benchmark loop as used with my test script > should be fine for ballpark estimates, as password_hash() is pretty > heavy, dwarfing the measurement overhead. > > Best regards > Tim D=C3=BCsterhus