Closed haijinSk closed 2 months ago
Now, I would say, the qualitative difference. A quantum leap towards the pio library as I use it, as I use everything in Prolog; as a naive user. Now I can handle even several-mega-long-string-list with the pio library in this context and no crashing/freezing, no the slow and total memory consumption, at least on my computer.
So I think, I have to close this issue. Thank you!!!
Using v2.50.26, for the record; not saying that my mega-long string (cca 2_000_000 and more chars) example ever worked on my computer in Trealla.
With dcgs and pio library loaded, for example this:
length(L, 3_000_000), maplist(=(a), L), phrase_to_stream(seq(L), user_output).
will, slowly, but gigabyte by gigabyte, eat all the RAM, and if I will be lucky, so to speak, my OS will kill the process with the message:
Killed
. The same withphrase_to_file/2
.My 16 GB RAM computer can handle the phrase_to_stream (and phrase_to_file) example with a string/list 1_000_000 chars long without the freezing/crashing, but it's the quantitative, not qualitative difference, so to speak.
Yes, besides simply using
format/2
and the Linux redirection to a file, I can save the 3-mega-string constructed using DCGs/in the "list-way", without (from a naive user's point of view) the unexpected "RAM aggressivity":Or, accepting the list vs string dichotomy, I can use Trealla's
savefile/2
:Thank you.