emacs-devel
[Top][All Lists]
Advanced

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

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


From: Clément Pit--Claudel
Subject: Re: [PATCH] Elpa: Pinpoint semantics of `seq-subseq' for streams
Date: Thu, 15 Sep 2016 18:18:19 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 2016-09-15 17:07, Michael Heerdegen wrote:
> 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 is orthogonal to the list-vs-stream debate, isn't it?

> 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.

[citation needed] :) Garbage collection costs time; memory costs, well, memory. 
 It's just a trade-off.

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

Sure, but again: how is this related to lists vs strings? Lists need to be 
garbage collected just the same.

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

I'm not sure what you mean :\ Are you saying that sometime streams are not the 
right solution for a given problem? I agree fully :)

Cheers,
Clément.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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