[doc-en] master: Correct memory usage estimation in range() documentation (#4680)
| From: | Naoya Harasawa via GitHub | Date: | Wed, 19 Aug 2026 06:04:14 +0000 |
| Subject: | [doc-en] master: Correct memory usage estimation in range() documentation (#4680) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23580@lists.php.net to get a copy of this message | ||
Author: Naoya Harasawa (rururu3)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-08-19T08:04:11+02:00
Commit: https://github.com/php/doc-en/commit/a8c1fc582e4917898980533b90fab4a598aede0f
Raw diff: https://github.com/php/doc-en/commit/a8c1fc582e4917898980533b90fab4a598aede0f.diff
Correct memory usage estimation in range() documentation (#4680)
* Correct memory usage estimation in range() documentation
Updated the PHP manual to reflect a more accurate memory usage estimate for range(0, 1000000).
Previous documentation stated it used over 100MB, but actual tests show around 18MB.
Revised the estimate to 10MB for better accuracy based on real-world testing.
* Use simpara for the paragraph touched by this change
---------
Co-authored-by: lacatoire <la.catoire@gmail.com>
Changed paths:
M language/generators.xml
Diff:
diff --git a/language/generators.xml b/language/generators.xml
index ad41e84e6dea..9533b7722fdb 100644
--- a/language/generators.xml
+++ b/language/generators.xml
@@ -28,14 +28,14 @@
Like with iterators, random data access is not possible.
</para>
- <para>
+ <simpara>
A simple example of this is to reimplement the <function>range</function>
function as a generator. The standard <function>range</function> function
has to generate an array with every value in it and return it, which can
result in large arrays: for example, calling
- <command>range(0, 1000000)</command> will result in well over 100 MB of
+ <command>range(0, 1000000)</command> will result in well over 10 MB of
memory being used.
- </para>
+ </simpara>
<para>
As an alternative, we can implement an <literal>xrange()</literal>