From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bjarte Johansen Subject: Using buffers instead of string when processing and passing org-babel results Date: Fri, 22 May 2015 13:02:51 +0200 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvkjG-0000nz-SO for emacs-orgmode@gnu.org; Fri, 22 May 2015 07:03:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yvkj9-00038K-EU for emacs-orgmode@gnu.org; Fri, 22 May 2015 07:03:02 -0400 Received: from mail-la0-x236.google.com ([2a00:1450:4010:c03::236]:33312) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yvkj9-00037z-7U for emacs-orgmode@gnu.org; Fri, 22 May 2015 07:02:55 -0400 Received: by lami4 with SMTP id i4so10105548lam.0 for ; Fri, 22 May 2015 04:02:54 -0700 (PDT) Received: from pc-115-186.eduroam.uib.no (pc-115-186.eduroam.uib.no. [129.177.115.186]) by mx.google.com with ESMTPSA id ra7sm407239lbb.27.2015.05.22.04.02.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 May 2015 04:02:53 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode 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=E2=80=99t 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=E2=80=99t interested in the change I am not sure = I will bother. Regards, Bjarte=