all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: kaushal.modi@gmail.com, emacs-devel@gnu.org,
	tino.calancha@gmail.com, mathias.dahl@gmail.com
Subject: Re: [PATCH] New command to invert lines in region
Date: Sun, 16 Oct 2016 17:00:16 +0300	[thread overview]
Message-ID: <83wph8z95b.fsf@gnu.org> (raw)
In-Reply-To: <CAM-tV--0tCb4m9+tHjSrgkyowZX3Fq1p=j3bZBhtur9ikpNHKQ@mail.gmail.com> (message from Noam Postavsky on Sun, 16 Oct 2016 09:24:25 -0400)

> From: Noam Postavsky <npostavs@users.sourceforge.net>
> Date: Sun, 16 Oct 2016 09:24:25 -0400
> Cc: Kaushal Modi <kaushal.modi@gmail.com>,
> 	Emacs developers <emacs-devel@gnu.org>,
> 	Tino Calancha <tino.calancha@gmail.com>
> 
> 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	other threads:[~2016-10-16 14:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-03 10:43 [PATCH] New command to invert lines in region Tino Calancha
2016-10-03 11:02 ` Kaushal Modi
2016-10-03 11:21   ` Tino Calancha
2016-10-03 11:33     ` Tino Calancha
2016-10-15 22:25       ` Mathias Dahl
2016-10-15 23:57         ` Kaushal Modi
2016-10-16 11:03           ` Mathias Dahl
2016-10-16 13:24         ` Noam Postavsky
2016-10-16 14:00           ` Eli Zaretskii [this message]
2016-10-16 18:25         ` Kalle Olavi Niemitalo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83wph8z95b.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=kaushal.modi@gmail.com \
    --cc=mathias.dahl@gmail.com \
    --cc=npostavs@users.sourceforge.net \
    --cc=tino.calancha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.