[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Elpa: Pinpoint semantics of `seq-subseq' for streams

From: Michael Heerdegen
Subject: Re: [PATCH] Elpa: Pinpoint semantics of `seq-subseq' for streams
Date: Thu, 15 Sep 2016 23:07:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Clément Pit--Claudel <address@hidden> writes:

> > but the same applies to a list.
> Not exactly: the list needs to be fully built before you iterate over
> it.  That's when the memory problems occur.  So yes, during iteration
> you can discard the cons cells that you've already seen in both cases,
> but in the list case these cells need to all be constructed and kept
> in memory beforehand.

But I think what John said is still a valid argument: If you construct a
stream of lines of a process's output (just for example), of, say, 10000
lines, you create 10000 new objects (strings), and you discard 10000 - n
of them.  They all need to be garbage collected.  This will not only
take a large amount of time - garbage collection happens not all the
time, so memory will be filled to a certain amount as well.  But I think
the impact of garbage collection of that many objects is a more serious
problem than memory usage anyway.

Instead, a simple loop incrementing a position variable or something
like that might be more appropriate (efficient).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]