Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104277 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 63034 invoked from network); 7 Feb 2019 12:54:16 -0000 Received: from unknown (HELO mail-yb1-f170.google.com) (209.85.219.170) by pb1.pair.com with SMTP; 7 Feb 2019 12:54:16 -0000 Received: by mail-yb1-f170.google.com with SMTP id s17so3707022ybp.6 for ; Thu, 07 Feb 2019 01:35:52 -0800 (PST) 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=irK/e+Kbh2q/Mu/wU0l3lOyUQLVvNskmoxxx6fyOEeU=; b=CGEqyAQaWWLTgz5pj2wOVVkMlbE0+DhoZ6nZpMTao0Z++JXAimB8KB3iD4/QtL66lN 3fFW/jwCyUrKshgDZIbmRwR324iVny0BKSRyWdoRub0t7SkbrIEBFhVEvEjU8UhnFPBR sucRHVCjY0yP80fPZ8gJvCxw6e96PRgQWEm6SA3YXH8KA90EDHyRQQ4GRMItdu7/LH4I BfhfdWtBrB44UFPRMSCP23ZD9hBhM1LKQEdBcHnGfmQG5p0xQbw1y6ylH7ZP+KByQIwr cVBEwauOV3d0EbRv0u6zGh2uVgtvjJUBTypxvN06wuo7vvFB8O95gLPgLgMRCWNvNj6O Rl2Q== 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=irK/e+Kbh2q/Mu/wU0l3lOyUQLVvNskmoxxx6fyOEeU=; b=EgaSJyQmsnhPYgUfAZNtjC6NHzUYPNyuxXuR8qIGsnlHzdne7Huyom+sgYI/7Pp0Lv dlv3AqinGibF0/TPyb/DfaXSzCSwAUi32Bne5HBiyC9iPXgQS8oNfg/UsvWwZg3LvGZ2 hsEDo9lfXwv6gXX8P6pmMdW4za8E/axX8AvN7huPSKvm0I+gwn1pexQ7kSzCkb+bFdwB jnWTUt+oWctn1IFdmyOyijx1czokGOgnXCqHZ4okSvJ/kaapMVI0RsyN+Qlt5SRqExgK VjNn467+lu8HL5FpFwHoRRwe8sn+DWm/Xiiy599F0w2rmHLly6X58ZxhfcAYARsQWMzN hAdg== X-Gm-Message-State: AHQUAuY9FKtz9s5pJRdcnF3Qj7kg3rYQ7RxlxMC78COftZ7IhT4ClbYP BPBuhtcDRSnu9RY1BJl2j5rw8auwPo6Guo33Dgk= X-Google-Smtp-Source: AHgI3IYrtYkKDmDQ+coF5pHudruczUXoTDbTPiE+GbY/cKk+Fcn4rpIABs4okwcxJ6dhSGO8vk7UTDCpFJsxwp1RrIQ= X-Received: by 2002:a25:6884:: with SMTP id d126mr10504380ybc.417.1549532152552; Thu, 07 Feb 2019 01:35:52 -0800 (PST) MIME-Version: 1.0 References: <595b374c-bc4f-9b8a-0013-6485abbfb477@php.net> <41D0A782-E4E2-4B98-9C5D-174143DE9A76@gmail.com> In-Reply-To: Date: Thu, 7 Feb 2019 10:35:40 +0100 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000085605005814a912a" Subject: Re: [PHP-DEV] Re: [RFC] [VOTE] Typed properties v2 From: benjamin.morel@gmail.com (Benjamin Morel) --00000000000085605005814a912a Content-Type: text/plain; charset="UTF-8" > > apologies if I've missed it, but have you actually said what that use case > is? Sorry if it wasn't clear in my original post. The use case is the following: - a data mapper retrieves an object from the database - for optimization purposes, we can ask the data mapper to return a partial object, with only a handful of properties initialized - when saving the (potentially partial) entity to the database, the data mapper needs to read initialized properties only So this would require to be able to quickly (faster than reflection) detect if a property is initialized before attempting to read it. To summarize what's been said so far (provided that my understanding is correct, as I haven't received additional feedback from Nikita yet): - an additional language construct similar to isset(), but returning true for null values, would not be particularly welcome - an additional function such as property_is_initialized() could do the job Note that I don't want to be pushy for an additional opcode for property_is_initialized(), this can be discussed later if benchmarks justify it. For now, just adding this additional function should be enough to bring at least a 2x performance improvement over reflection when reading all *initialized *properties from an object (benchmarked using a no-op function that always returns true). Ben On Wed, 6 Feb 2019 at 23:21, Rowan Collins wrote: > On 06/02/2019 22:10, Benjamin Morel wrote: > > But we digress, can we focus on whether to add another isset()-like > > construct, or a property_is_initialized() function, ideally with a > > companion opcode to speed it up? > > I apologise for the digression. However, there is some relevance, > because asking for not just a new function, but a new opcode, suggests > you have a use case that is both common and performance critical; > apologies if I've missed it, but have you actually said what that use > case is? > > > > Pardon my ignorance, but what is exactly increasing the language > complexity? Do you mean the addition of a language construct to the parser? > > Notice that Nikita said "conceptual language complexity", not > "implementation complexity" - regardless of how simple this is in > implementation, it's one more thing to document, maintain, and answer > questions about. > > > Regards, > > -- > Rowan Collins > [IMSoP] > > --00000000000085605005814a912a--