Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118602 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 81571 invoked from network); 10 Sep 2022 15:10:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Sep 2022 15:10:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E4DB01804AB for ; Sat, 10 Sep 2022 08:10:55 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 10 Sep 2022 08:10:55 -0700 (PDT) Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-333a4a5d495so50911987b3.10 for ; Sat, 10 Sep 2022 08:10:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=d3ZB2BeSgazcJQ1C9PAzWad2B+qAg8T55mnh0RrH9j8=; b=CG4i0ZhupPu4YLLxsGdM6TXrlg7K1atq1f7LI85s+v3U3MeBv5svXTet7tprsxkM44 rYSpa+AADQqYZixkvqanZikWL37D6/PVZfDKcVearU745i0uqSx9Hv0yxIrY4m3EFT0a RmSoAXxDXueqOtcG+EST51jDa68KXu7WxJVMhlCNhp0r5c0La6X1ifvmCFvckaEyn/pA o74ofh0Ykn2eECwKovkWv9BlJGAHY8b6FXuWhIDbcNjHnSDbxwyRxE1V9mQqnTrn7yOM 3/yV72twPX1xCraMBXhkCD8ONwQRq6t8eHWl1jQ6ZPdN3ER8yEKeiS0he/1PQEtw1Fbc hdtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=d3ZB2BeSgazcJQ1C9PAzWad2B+qAg8T55mnh0RrH9j8=; b=Ij4BIbiLFs/C/5hYz086PbAmLEXzxgUZPGFUExntfInYxPrBj4uWps6kt2/baXJJp2 ir7tJkijUu3oAHRcTxKmyJz6Auwzp2u2uoLIF2StUnEpe4TPfpGvhqx5Ocj9tCcxkNnX zA03K6e6B+7+9G45QCbtDRRvJE++XVvXjDM32V833I+Iv/8hzluiLUpuoucxB7c+WGuK NcV5ygcorUyv4vwzvRu1MYZcCNK/wFcbjjPDHcP3O7VQfKBbtU/QVjdivDRVqT0ZpivG 6/Ee3aUPn/uecpIdeLP0hx+yS4a9Bu1KhtmtNNgN5lm3tX4nMo0ehXW2vux2GXoqDRfi Bl8g== X-Gm-Message-State: ACgBeo24jg7HVmbEBLumPHFEXcKqfOrWHdStV7T0zPqL/5+ti0KuVZPV UTsfouMarRRUSSAXeLGxuwtc+YWLRdUw4hSyrpcnY3L7dk0= X-Google-Smtp-Source: AA6agR5kEU3dR1JshLdqCQ1Tp3Qb4CpSZPhh/cIMT/JMvIEwRX1iVbdYPTwMGSJp/mGfn+USjGKARpT/PfIcrH7LZFk= X-Received: by 2002:a0d:f402:0:b0:33c:eda4:8557 with SMTP id d2-20020a0df402000000b0033ceda48557mr15579683ywf.183.1662822654868; Sat, 10 Sep 2022 08:10:54 -0700 (PDT) MIME-Version: 1.0 References: <3ba19901-2a14-3869-0c65-5b4bfed5bcb5@gmx.de> In-Reply-To: <3ba19901-2a14-3869-0c65-5b4bfed5bcb5@gmx.de> Date: Sat, 10 Sep 2022 18:10:43 +0300 Message-ID: To: "Christoph M. Becker" Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000aaff2605e85411e9" Subject: Re: str_repeat performance From: zsidelnik@gmail.com (Eugene Sidelnyk) --000000000000aaff2605e85411e9 Content-Type: text/plain; charset="UTF-8" Oh, yes. Sorry for that. Thanks for pointing out. On Sat, Sep 10, 2022 at 3:23 PM Christoph M. Becker wrote: > On 10.09.2022 at 14:19, Eugene Sidelnyk wrote: > > > I have noted some strange points about `str_repeat` performance. It looks > > like the lesser `$times` argument is, the bigger is execution time (only > if > > we consider big numbers). > > > > For example, `str_repeat('%d ', 12500);` is a lot slower than > > `str_repeat('%d ', 1250000)`. > > > > First case (slow one): > > https://3v4l.org/ZAoGi > > > > Second case (fast one): > > https://3v4l.org/YIdQM > > It seems you have misinterpreted the results. 4.792213439941406E-5 is > certainly much smaller than 0.013129949569702148, for instance. > > -- > Christoph M. Becker > > --000000000000aaff2605e85411e9--