Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104836 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 9799 invoked from network); 21 Mar 2019 03:47:31 -0000 Received: from unknown (HELO mail-ot1-f47.google.com) (209.85.210.47) by pb1.pair.com with SMTP; 21 Mar 2019 03:47:31 -0000 Received: by mail-ot1-f47.google.com with SMTP id u15so3941224otq.10 for ; Wed, 20 Mar 2019 17:39:32 -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=//p7nLyIob7uNz8DgtQ76HDYcxj/PEtPsC7u4b5QS20=; b=XUQKhVK/WHT0ChJJ9suIHESM0jfFW/LB3PnHEtFwroGXWKwqQS0e5vYtQPdtYNXuWu Q44J59yz1vpcIxBpQgxc7kAn7iIu/W+ymx1+F8E6PGBUXbLI6sWRaN1aCfV+FLonzKNZ pT4OD87K62CO1XjXN8EixvJWm2WrdXQhYBX3EgVe7EnRHA1WlBlKM9ESfEaARlZAnRl6 o1YS2Mfs1Q4xuPz/EqFnxGmWLwWHXoclkRPoVBS4rsXn3JPcoFW+z8fGYEVe1RFKEefk CKThDwHip2AjExBmUHR+YfuYcl3OGGpX2HZSCRHb7BMSnJzGYIGNbCpPisVnpAjuP9S5 bsCw== 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=//p7nLyIob7uNz8DgtQ76HDYcxj/PEtPsC7u4b5QS20=; b=rVKMJaHjrt1IMIjby6bZbs+9UhMJeWoIarN+p4sH1/JU+frQrzuWrgjni48CW1mxq3 1zpEfGNav3Jnbtp6A/YjPlMdeFvk9hRKsMS/qNi/IAS8tOnbqq6ovFDr8NiGrLjLZ2nn BG3J47qhZn4KnsLh0sRZBIf3UrGz19sNPuKCp1aAM9EBtWx0Q97Tpt5XTKWD21GXKeRu GitluOGXZy+uyGFQx4A1oQRuJ1FMHfaFCzNBodHe9YV8cRO8hKWMrpvPW+VziMQxVA5F 8JyPXy9ZwuV4orADfr115YVeCohNE9vEtyUTBpiG0ZbhqHziBEs5URL6sP66SkC1+vpc xzWA== X-Gm-Message-State: APjAAAVVo4lbeODLcEahLMlEI+JnIKHCTtFadPP56gyFK22IMDCRu58+ c+/AwQP/RX7NrNPF40lfNOJoCK+ybA8u2McRgLc= X-Google-Smtp-Source: APXvYqy2QmpZiS7VtV3wqN4zgYpWbQqbcKrsthx/pUn96p3vURRIUqByifJZqQmBvgRKx5i5DB/rMAcqvbCu8IovG/4= X-Received: by 2002:a9d:62c8:: with SMTP id z8mr688500otk.144.1553128771701; Wed, 20 Mar 2019 17:39:31 -0700 (PDT) MIME-Version: 1.0 References: <85417a73-a391-c9ad-49aa-5b88c65b0900@gmail.com> <5c8ea43d.1c69fb81.e50f1.7d18SMTPIN_ADDED_MISSING@mx.google.com> <0d34b3b1-866e-4bab-9a8f-3c70f1fc9721@www.fastmail.com> <752c83ab-0e6f-d8f5-ff15-e1f75b5d04b5@gmail.com> <301552a9-6f01-3177-0e57-3d9aac54cc0c@gmail.com> In-Reply-To: <301552a9-6f01-3177-0e57-3d9aac54cc0c@gmail.com> Date: Thu, 21 Mar 2019 00:39:20 +0000 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] RFC Draft: Comprehensions From: robehickman@gmail.com (Robert Hickman) > > Hi! > > > >> It's not that you can't make an array into a generator, but you can't make > >> an eagerly-evaluated expression into a lazily-evaluated one. > > Not sure what you mean here. > > > I mean that, given a syntax that lazily-evaluates something, you can > "fast-forward" the result to make it eagerly-evaluated; given a syntax > that eagerly-evaluates something, you cannot do the opposite. Therefore, > a lazy-evaluating syntax is more powerful, in that it can do everything > an eager-evaluating one can do *and more*. > For my use case of PHP, get some content from a DB and dump it into a template, I don't see much benefit to generators. Such content is textual and is small relative to available ram. Memory locality also matters for performance and it is generally faster to do a whole bunch of stuff at once, thus I'd expect an eager version to be faster than a generator. I'm almost sure it would be faster if stepping the generator entailed IPC, reaching out to a database for instance.