From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: speeding up Babel Gnuplot Date: Mon, 02 Jan 2017 00:34:46 +0100 Message-ID: <87d1g6qrqh.fsf@nicolasgoaziou.fr> References: <5864217C.7060001@free.fr> <586963CB.1000006@free.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNpeS-0002lK-4s for emacs-orgmode@gnu.org; Sun, 01 Jan 2017 18:34:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cNpeR-0005xB-EX for emacs-orgmode@gnu.org; Sun, 01 Jan 2017 18:34:56 -0500 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:40046) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cNpeR-0005x0-8V for emacs-orgmode@gnu.org; Sun, 01 Jan 2017 18:34:55 -0500 In-Reply-To: <586963CB.1000006@free.fr> (Thierry Banel's message of "Sun, 01 Jan 2017 21:17:15 +0100") 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" To: Thierry Banel Cc: emacs-orgmode@gnu.org Hello, Thierry Banel writes: > Babel Gnuplot can be further accelerated. A table is converted to a > temporary file readable by Gnuplot. I found two issues in this process: > 1. the temporary file is generated twice, > 2. the generation is quadratic. > > I have not provided a committable patch because I am not happy with myfixes. > > Of course there is no hurry in fixing that because large tables do not > happen so often. > > ------------------------------ > > 1. Temporary generated twice > Because org-babel-gnuplot-process-vars is called twice. > > There is no obvious fix. Here is a dirty patch. It caches the name of > the temporary file in the 'param' list. This may not be an issue if `orgtbl-to-generic' is sufficiently fast. > 2. Quadratic behavior > The spot is at ox.el::5119(the lambda in org-export-table-row-number). > > This lambda is called a number of times equal to the square of thesize > of the table being plotted. For a 2000 rows table, this is > 2000x2000 = four millions times. The cache a few lines before does > nothelp because each row is visited only once. Fixed. Thank you. I also optimized a bit more `orgtbl-to-generic'. Hopefully, Babel Gnuplot should be responsive again of large tables. Regards, -- Nicolas Goaziou