Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113155 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 89845 invoked from network); 12 Feb 2021 16:05:29 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Feb 2021 16:05:29 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A161D1804D3 for ; Fri, 12 Feb 2021 07:51:14 -0800 (PST) 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_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-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 ; Fri, 12 Feb 2021 07:51:14 -0800 (PST) Received: by mail-ed1-f47.google.com with SMTP id v7so214823eds.10 for ; Fri, 12 Feb 2021 07:51:14 -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=9J0K7j/ofFHsDyfNrbQgA0ArjmzPDfdAxV23nbAGoHw=; b=cuLzpky4Vk/UNc/5DP/c12bsaFBXXHZw46NFGyK1yjsI6MtoG53YTvU5x9jETcBF7G k4sEfoMXRYyBBxPguPcTpOZE0mIQez6stH1ftb/LtK+PGSTgV9lpy0weq94/Zpzv95mH 6qCuHFw38EvlBCU15T6r9ijvu+THRafInosby/ddmCphlsV/QLlOBYn1xx6YPVlQNXV5 kZsAe4Uz97eamHRMmsnj1B3QVeP6u/OmcVM29nGX10lwDzR7+rSaIipYIH0XPMdxMA+6 I4vjERJKQqHsIc9oYbzg8XJPfW4P99CeOST8oVBKX2M55VL+mIlQz0X4GyUPOrmF13Lf swCA== 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=9J0K7j/ofFHsDyfNrbQgA0ArjmzPDfdAxV23nbAGoHw=; b=gEaqi9KkfBYjO/2Q/HG7tUCHizi3WkDFl2hr5x7sR6zYrfuPV+7fdF2fYvf9a0M8PT rhrCbGjthLwPoANX6Fby82C80uUcWTLy1sD1qY4TQchxGZruotLku4QUKuNLyyf3PIXQ csoylo5vh9AlQ+NrzwC0eWVF8k5/z4emAt7opgx+Y0Uks3l0ixO3TPfJP4aPH2t/DWSb uY8YyrxMZ3c+ZenMuRmPJswvy6kpfvCXIri8O1GysF9RlctgvoaMfYOOwa9qqN8+OD04 qlHSwBSDiXVyafOBa0vkHn0WL0rMW6a9gffe1fZyv+UuHVUtdBL0TDpIVlXMPiTN/M5r wcuw== X-Gm-Message-State: AOAM5305tlCmOROdIt4wFNy9/RB1LkblytTv/uoCpZiGZ2B75jmJoo7f jo8Ypc/dFu3PJO/hgfsqGzc5x4764Wh0gS3xLZkT8Mw2eUWE6A== X-Google-Smtp-Source: ABdhPJyr9auvRhafLASFUe1WEOiv/WeW2xFP20UZU4n53QUsn7Vc18cKB0F5gGUodwGhLYUjj+pvbDg0oA1pSfT+IRU= X-Received: by 2002:a05:6402:306c:: with SMTP id bs12mr4029704edb.348.1613145071671; Fri, 12 Feb 2021 07:51:11 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 12 Feb 2021 17:50:54 +0200 Message-ID: To: tyson andre Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000f7df2d05bb259a8a" Subject: Re: [PHP-DEV] RFC: CachedIterable (rewindable, allows any key&repeating keys) From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --000000000000f7df2d05bb259a8a Content-Type: text/plain; charset="UTF-8" On Thu, Feb 11, 2021 at 5:47 AM tyson andre wrote: > Hi internals, > > I've created a new RFC https://wiki.php.net/rfc/cachediterable adding > CachedIterable, > which eagerly evaluates any iterable and contains an immutable copy of the > keys and values of the iterable it was constructed from > > > Any other feedback unrelated to namespaces? > > Thanks, > - Tyson > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > Hi Tyson, I needed this feature a few years ago. In that case, the source was a generator that was slowly generating data while fetching them from a paginated API that had rate limits. The result wrapping iterator was used at runtime in multiple (hundreds) other iterators that were processing elements in various ways (technical analysis indicator on time series) and after that merged back with some MultipleIterator. Just for reference, this is how the implementation in userland was and I was happy with it as a solution: https://gist.github.com/drealecs/ad720b51219675a8f278b8534e99d7c7 Not sure if it's useful but I thought I should share it as I noticed you mentioned in your example for PolyfillIterator you chose not to use an IteratorAggregate because complexity Was wondering how much inefficient this would be compared to the C implementation. Also, the implementation having the ability to be lazy was important and I think that should be the case here as well, by design, especially as we are dealing with Generators. Regards, Alex --000000000000f7df2d05bb259a8a--