emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] New command to invert lines in region


From: Eli Zaretskii
Subject: Re: [PATCH] New command to invert lines in region
Date: Sun, 16 Oct 2016 17:00:16 +0300

> From: Noam Postavsky <address@hidden>
> Date: Sun, 16 Oct 2016 09:24:25 -0400
> Cc: Kaushal Modi <address@hidden>,
>       Emacs developers <address@hidden>,
>       Tino Calancha <address@hidden>
> 
> Using split-string does seem like a good idea though

But doing so makes the Emacs footprint momentarily hold 3 different
copies of buffer text: one in the buffer, one in the string created
with buffer-string, and one more after split-string.  Right?  The
version in sort.el, OTOH, only ever keeps a single copy of that text,
plus the current line, because each line is deleted from the buffer
once it is added to the list of lines kept as strings.  So with very
large buffers, the version by Mathias will run out of memory sooner.

What I'd try is rewrite the function to move text between buffer
locations directly, without involving strings, because that should be
more efficient, as fewer objects need to be consed, and copying text
from and into buffers is more efficient in Emacs than going through a
string.



reply via email to

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