> > 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. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php