Bonsoir Jean Louis,

On 20.07.2026 21:05, Jean Louis Faucher wrote:


On 20 Jul 2026, at 18:54, Rony G. Flatscher <[email protected]> wrote:

The questions:

  * So there are two indexers/iterators, one for CodePoints, one for Graphemes?
  * What is the purpose of "storage limits" when using both iterators, why do 
they exist?




See https://html-preview.github.io/?url=https://github.com/jlfaucher/executor5-bulk/blob/main/main/trunk/extensions/unicode/rxunicode.html#init-2
In particular the example 3 and 4.

thank you *very* much!

The above link is an excellent documentation and explains a lot with a lot of insight (although there are corners that are not yet quite understandable in full). (There will be definitely a need for a Unicode related book with this documentation.)


Illustration:

Tested on macOS:

Assuming you have a 10 MB string.
tutor off
string = "Family 👨‍👩‍👧" || "*"~copies(10000000) || "🤶 and 🎅."
Duration 0.03 s.
The activity monitor shows 143.9 MB for the rexx process.

You want to test if the string starts with "Family 👨‍👩‍👧" and ends with "🤶 and 
🎅.".
No need to store the codepoint indexes, you need to store a few grapheme indexes (let say 10) on both extremities.
A full scan is always performed, but the storage is limited.
indexer = .RexxUnicodeStringIndexer~new(string, 0, 10, 0, 0, 10)
The rexx process memory remains stable at 143.9 MB
Duration 14 s (it's not native)

indexer~graphemeCount=         -- 10000016
indexer~graphemeIndexes=       -- [ 1, 2, 3, 4, 5, 6, 7, 8, 26, 27]
indexer~endGraphemeIndexes=    -- [ 10000039, 10000035, 10000034, 10000033, 10000032, 10000031, 10000030, 10000026, 10000025, 10000024]

With an unlimited storage:
indexer = .RexxUnicodeStringIndexer~new(string)
Duration: 33.5 s
The activity monitor shows 2.14 GB for the rexx process.

indexer~graphemeIndexes~items= -- 10000016

WOW, very impressive regarding memory consumption (also being three times slower is relevant, but not as frightening as the memory consumption IMHO)!

Great example, very clear explanation, many thanks again!

Best regards

---rony

_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to