Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111862 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 1769 invoked from network); 15 Sep 2020 14:15:12 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Sep 2020 14:15:12 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D041F1804C3 for ; Tue, 15 Sep 2020 06:23:19 -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=0.6 required=5.0 tests=BAYES_50,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 autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 15 Sep 2020 06:23:19 -0700 (PDT) Received: by mail-vs1-f51.google.com with SMTP id j6so1877061vsg.8 for ; Tue, 15 Sep 2020 06:23:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=21xk8Ki9iognPEEfxZXe+UHiGHkGi+mti958YUasJzI=; b=kSZGfI1XXqbwhqLtyTXQiLX4ThzXk2WW2mx0XJX1BTLwL7Nb7o3lqQC0aHMy+ZvO6n OdZ/4Ti3hwA4Fbz31NClfRhyLaaLzPs7gOAZdPS/UjzAfMtRIGObVS2Igslh6YPUhGwg f4tYqCBidhpsZDQPpxuIyMNtiEWH6i5VGMXG3Cw1CIhrgw2qNEchobOLHhPlmX0dvL7Q f2F/G9M74OhXEwUGYNB12OGhG1W5B5i8lDrV1k3Tk2AlC8cmB/gvTGOo3mfGtOZ9YolK euDKp7VGWTMP3gDI8tX+puN34Br0vNyScODE0nMFBDVPi3T3ndVxOHbwDrcI1k4prH5x Moqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=21xk8Ki9iognPEEfxZXe+UHiGHkGi+mti958YUasJzI=; b=SgyHPgTIF9/wEPDL/m5P7IaztC0TULeCt9tKMMfIbpmKuQQj+wcqOkCCdiciZOiMoY iKNgQMYY5R00HP7jATocpsYq2fiWmua5Vpu1iD1QilJB9b8PDcvmXHTUQN0UvOAJwqj0 18Dxm9JiQZPTQaAthCTI+MEncUNloBUVF/cT1iiMU0aCrwNvKUUNrASH00qzKmouMkan dMUWszO/RWvYZK5al/qmAWeNOOfDMEHP53aSQ454JJ43lmW2GIGXGqhH+Es21SZRPWub 9KPLMU+b5o0UlMdxn590f1073Nr2XVkayIX0KR83Fgks0gZv8DK4kHLbTG2KLqF9t3FM ow1g== X-Gm-Message-State: AOAM530mhviPDxGve0EcB0UoP7rF3+AZH9YGExXZ4xiOgZ5pra/Jbz4d 1EtlBxEibQxi1Ifn/yI4GtKXmRioSUluyxnOAXb8F6um1LVgxA== X-Google-Smtp-Source: ABdhPJzMhmF6Tvr3PCJ3qQTggL+TGjkdRdkf8JD6oFUeL3FEUrtcdB3kff3K+5tzdCogeVZHrc0cgMaSBvPKAYuWSM4= X-Received: by 2002:a67:6646:: with SMTP id a67mr909722vsc.50.1600176196262; Tue, 15 Sep 2020 06:23:16 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 15 Sep 2020 09:23:05 -0400 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000c19d5305af5a0d33" Subject: Compiler Optimizations From: chasepeeler@gmail.com (Chase Peeler) --000000000000c19d5305af5a0d33 Content-Type: text/plain; charset="UTF-8" I brought this up on another thread, but it wasn't addressed (which is fine, since it was somewhat off-topic). I thought it might be worth bringing up in its own thread, though. In the other thread, someone had mentioned the following compiler optimization foreach(\array_keys($arr) as $key) { and quietly transform that into: foreach ($arr as $key => $_unusedVariableNameThatIsntEvenSpilledToTheScope) { I would be more likely to write: $keys = array_keys($arr); foreach($keys as $key){ Which would prevent me from being able to take advantage of the optimization. So, what I was wondering, is if there are other optimizations I might be missing out on, and if so, are they documented anywhere? -- Chase Peeler chasepeeler@gmail.com --000000000000c19d5305af5a0d33--