Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114612 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 69008 invoked from network); 26 May 2021 10:45:12 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 May 2021 10:45:12 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2E2721804B0 for ; Wed, 26 May 2021 03:56:42 -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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (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 ; Wed, 26 May 2021 03:56:41 -0700 (PDT) Received: by mail-ot1-f46.google.com with SMTP id n3-20020a9d74030000b029035e65d0a0b8so591410otk.9 for ; Wed, 26 May 2021 03:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bWCHhYUI5g8TAfPYMl5wdyccFLuxIvdQMbLPyWt6POE=; b=IAs5B0C21lq0LIvYriBECAA/wPMFP29tYLxOok2NqKDxflSzORp1BK3wYt+4y11cNA hpZURqFW2/P6O7dgMt+SNvJMUjZRc5JupUdrjepCID3vD5D9nBw4rX3MDWUR5o9tmOHe CEeViiQ3rN7icbOziiBYCDEBc7OIfXh7YtybtfFm5jzUjJKR/a3BTjCxtxfZmmjffspA G3o9bJZs+mhq9peOOmbBTlPUIX93DwI46JnAgoRnppVCrac/PnK7QlpAeUnpIuEWVZ8Z 9MP880r4zV8N2+A/GX9iX5gQmZid4qI2XhFSXIiA7mDsWiu1UFQco6Sy2zEF6R1T/ipU +oBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bWCHhYUI5g8TAfPYMl5wdyccFLuxIvdQMbLPyWt6POE=; b=oXx6m8GcB3C4qMNYyFAo5Ev/U2w1Sf9IUkVt1dwRCHkHgK3D4NWbMplp/OZTLqRn64 iU40vtJzDKrfn2HLYimEkfDpKt2pMkJFLsTn6oBvlhxKtvHtSu3SdD57r4RxzNUWbDOe /ErWg+hVtybIlHa1ckF2ZHQALoeWzvQqPkWn6/xq/nnzejZCB37HHnjqK05JFYqlQgCD pPEcgBYjQC7PqFx/bYL0gL5xPJr6SkLMjJTVrOpgUN070KIdxz6MUi29HDD+S2bQC0q/ 7ZO78GWbFOUfJSKl99U6ALynF+nSGfLYezeeNJ2q3JF6cY5NId0wf5kRIHX8szcnvNEN b0GA== X-Gm-Message-State: AOAM530gLpCZIG4DWYo4Alc7Niq6wTro4LAWqVbD0pYtb9mruwpI7FuN kkE1mgKCAzfSkZf5eTHr2wEZpuo6UwGg2eeofg8JivN0oJrneQ== X-Google-Smtp-Source: ABdhPJzv0UX3qFrzzVrr0cjqyrejv/ZWdJJAn9E52wgu7W2JW6Y3eJafwFumP0FlHvCSIT5Jb3ZeiKIrCcdzjx3I7Qw= X-Received: by 2002:a9d:39e3:: with SMTP id y90mr1920671otb.257.1622026598081; Wed, 26 May 2021 03:56:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 26 May 2021 12:56:27 +0200 Message-ID: To: Marco Pivetta Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000031e77805c3397fa7" Subject: Re: [PHP-DEV] Consensus Gathering: is_initialized From: krakjoe@gmail.com (Joe Watkins) --00000000000031e77805c3397fa7 Content-Type: text/plain; charset="UTF-8" Hi Marco, What do you mean by "meaningful benchmarks" ? There's no question that is_initialized will be faster than the reflector version, even with reflection caching. Here's a naive bench: https://gist.github.com/krakjoe/cef6452281624bdf1b46788f52a01521 krakjoe@Fiji:/opt/src/php-src$ sapi/cli/php initialized.php is_initialized: 0.04558 seconds reflection: 0.07186 seconds However is_initialized has a narrower scope than the reflector version, as mentioned in the PR, it specifically can only work on typed (accessible from calling scope) properties. I dunno if any of this helps you to decide if it's good or bad, but I'm particularly interested in your concrete answer to the question of badness. Cheers Joe On Wed, 26 May 2021 at 12:30, Marco Pivetta wrote: > > > On Wed, May 26, 2021 at 12:14 PM Joe Watkins wrote: > >> Hi internals, >> >> In response to: https://bugs.php.net/bug.php?id=78480 >> >> I implemented: https://github.com/php/php-src/pull/7029 >> >> Not absolutely convinced that it's a good idea, I asked Nikita to review, >> and he's unconvinced also and suggested a discussion should be started. >> >> You can read both of our thoughts about it on the PR. >> >> What I'm looking for now, is reasons that we are wrong - good use cases >> that aren't born from code that is doing bad things ... >> >> Equally if you think this is really bad even if the reason has already >> been >> mentioned, please make noise. >> > > > What's the problem with good 'ol `(new ReflectionProperty(Foo::class, > 'bar'))->isInitialized($baz)` ? > > If it's instantiation time/performance, I'm fairly sure that typical > reflection instantiation caching works just fine (and a new API would need > a lot of meaningful benchmarks to be warranted). > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > > --00000000000031e77805c3397fa7--