emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bjarte Johansen <bjarte.johansen@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Using buffers instead of string when processing and passing org-babel results
Date: Fri, 22 May 2015 13:02:51 +0200	[thread overview]
Message-ID: <D90E7590-C05F-4FA6-8924-9372A4E7B454@gmail.com> (raw)

Hi,

I have been wondering: Is there a reason org-babel passes around results as strings instead of buffers? I understand there will be more to keep track of and right now there is a great chance of breaking code (org-modes code and other people who depend on the current behaviour).

However, I just did an elementary test with the following

#+BEGIN_SRC bash :results verbatim
  cat file.txt
#+END_SRC

I created the file with the command `base64 /dev/urandom | head -c 100M > file.txt`.

If I execute the script in the normal way it takes more then half a minute to complete. If I on the other hand convert every point on the path that expect it to be a string to be a buffer instead it takes less than 5 seconds to complete the script and insert the result into the buffer.

I understand that it might not be normal to insert these big files into the org-buffer, but the problem is also there if you want to silence the result and pass it from script to script. The creation of big strings is really slow.

I also feel that buffers are more natural vessels for the results. They are easier to manipulate than strings in Emacs and are much much faster. A big problem however is how do we handle the buffers that are created? They won’t be garage collected, so we need a way to safely kill them when we no longer need them.

Is this something that org-mode is interested in? I could try to work on it, but if org-mode isn’t interested in the change I am not sure I will bother.

Regards,
Bjarte

                 reply	other threads:[~2015-05-22 11:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=D90E7590-C05F-4FA6-8924-9372A4E7B454@gmail.com \
    --to=bjarte.johansen@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).