From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yJ6sCr5IdWHwRwAAgWs5BA (envelope-from ) for ; Sun, 24 Oct 2021 13:51:26 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id QBRGBr5IdWEgOQAAbx9fmQ (envelope-from ) for ; Sun, 24 Oct 2021 11:51:26 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B4A2532165 for ; Sun, 24 Oct 2021 13:51:25 +0200 (CEST) Received: from localhost ([::1]:36238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mec28-0004wd-RY for larch@yhetil.org; Sun, 24 Oct 2021 07:51:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mec0a-0004w4-8q for emacs-orgmode@gnu.org; Sun, 24 Oct 2021 07:49:48 -0400 Received: from smtp5-g21.free.fr ([212.27.42.5]:15178) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mec0V-0005OY-JF for emacs-orgmode@gnu.org; Sun, 24 Oct 2021 07:49:47 -0400 Received: from [192.168.1.55] (unknown [88.162.223.185]) (Authenticated sender: emm.charpentier@free.fr) by smtp5-g21.free.fr (Postfix) with ESMTPA id 256EA5FFA0; Sun, 24 Oct 2021 13:49:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1635076178; bh=yeSlfCgK87OppaNlxXD00hLs5UhHcINb246dO+0fiKI=; h=Subject:From:To:Date:In-Reply-To:From; b=dLcV+mjEkdXzS6UCJD6joCemSLneKRm4q+NOBJ/T9ELbDcPIFW4R51m5RIIphlU0i 5Uocn51BTDSVMBXY/5egIPcPKIYBqpWusx9yWNvvA4g9WYIz2cDEvGzlYqmgcWIkJy R0hogWMPJFAHicNVtaF5cDJFBptZa1F++YN043fIwz4e3slDaOYTfK9gfByFtd25L8 GskIyE9GzQDv8Kq2oQ3KOCOC3ZBPHUix6iF4fRpKb0vn4P6V/2iM7UX+nJnGG0GrUb NnGrewTFiNmItDLPAxOMkXReSyBhrw3I1YijckTIih2HovlbKHGBwQQSf09Tbgpz+2 nGEJe+Y9tE16A== Message-ID: Subject: when does :cache not cache? From: Emmanuel Charpentier To: e.fraga@ucl.ac.uk, emacs-orgmode@gnu.org Date: Sun, 24 Oct 2021 13:49:34 +0200 In-Reply-To: 87mtn1o5mn.fsf@ucl.ac.uk Organization: =?ISO-8859-1?Q?Organis=E9?= ? Moi ??? Content-Type: multipart/alternative; boundary="=-FPzuZLu/M6vU43fzbEK4" User-Agent: Evolution 3.42.0-2 MIME-Version: 1.0 Received-SPF: pass client-ip=212.27.42.5; envelope-from=emm.charpentier@free.fr; helo=smtp5-g21.free.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635076285; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=7lh/0vK0U6D0WKh0rLDWuaT8bgT2xJUblXkRoQRDGsg=; b=CeLFckdUA0YHtgkgtbLFp+W1tpv6SD+kUv3Wj635M8gj6+UvjxVDI4MT3NrI7vZLp2zHUG Yrtvz0D6buLMxg/q6IIlrQR1jUE5eAn1kV0v1++G1AE1qF5TYhXXDelNooyOC/jORTcw4E dhGNrhJrOEYQRqoUys/eZsyivoC/4DURvyDNxoXSGygtQd/uxZOj1hZSpo6Jisx8XsjVaa VtTJ5QPv0WQ5cc0FBTLcrT9hy2MFq8ijCdpNSZ3oIRl+KbeIcKb8ZpcX3hal/7Mbf93ED4 N6nSxwG40yYNxtq4CLwypO7yKd+DUQ2b+ZkwvV4DyNe/skNsBb+sSsJ0EjYZFQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635076285; a=rsa-sha256; cv=none; b=Pkn2iTnjMIhOzJxHc0PXYiaKd4/S7/njL36EvfFrue8NPUmwYFrH+8Ny8gpoXf/fJ0IQHf X4kPNlxr3wgvxxuq9ZR2R8iQjGhSC0/kY+k9xcPKyOfrjiOUsPCdKmJDfQqKL7Jv3iDH4q fDQQdUagR20h7cAfL1HRxqzSM3B8ZLoQVL7x6114XhmsQrruKGqX86SrbJu17Obv4jd+ub Mr1CWf+O7LdwCS0ns8d7jfvgvq3opcmYtTUbycJoOYYjy/a3W0N6HMYhNposdWMyGxXrDD qWnAh1FquzNBMzj3noW9po3XP4vxd10YC6DLNDb2+zotFwHX1uKleMl7qAnThg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=free.fr header.s=smtp-20201208 header.b=dLcV+mjE; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.02 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=free.fr header.s=smtp-20201208 header.b=dLcV+mjE; dmarc=pass (policy=none) header.from=free.fr; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: B4A2532165 X-Spam-Score: -3.02 X-Migadu-Scanner: scn1.migadu.com X-TUID: LoN7hZY4OR5E --=-FPzuZLu/M6vU43fzbEK4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Workaround : cache the computations,not the plotting itself (which should be fast,and must be made on every table, anyway...) : #+options: toc:nil author:nil * Main text Use of a static table: #+call: timeit() #+call: testplot[:file test0.pdf](data=table0) #+call: timeit() Use of a slow function: #+call: timeit() #+call: testplot[:file test1.pdf](data=table1) #+call: timeit() Use of a /cached/ slow function: #+call: timeit() #+call: testplot[:file test2.pdf](data=table2) #+call: timeit() * Annexes :noexport: This is not exported, but computes results. #+name: timeit #+begin_src emacs-lisp (format-time-string "%Hh %Mm %Ss") #+end_src #+name: table0 | Val | Square | |-----+--------| | 0 | 0 | | 1 | 1 | | 2 | 4 | | 3 | 9 | | 4 | 16 | #+TBLFM: $2=$1^2 #+name: table1 #+begin_src emacs-lisp (sleep-for 5) (setq s ( list (list "x" "x^2") 'hline)) (dotimes (i 5 s) (setq s (append s (list (cons i (list (* i i))))))) s #+end_src #+RESULTS[46320b31c46cef901580bad78aee7032d97ffe64]: table1 | x | x^2 | |---+-----| | 0 | 0 | | 1 | 1 | | 2 | 4 | | 3 | 9 | | 4 | 16 | #+name: table2 #+begin_src emacs-lisp :cache yes (sleep-for 5) (setq s ( list (list "x" "x^2") 'hline)) (dotimes (i 5 s) (setq s (append s (list (cons i (list (* i i))))))) s #+end_src #+name: tf | festfile.pdf ] #+RESULTS[46320b31c46cef901580bad78aee7032d97ffe64]: table2 | x | x^2 | |---+-----| | 0 | 0 | | 1 | 1 | | 2 | 4 | | 3 | 9 | | 4 | 16 | #+name: testplot #+begin_src gnuplot :var data=table0 :exports results reset plot data with linespoints #+end_src HTH, -- Emmanuel Charpentier --=-FPzuZLu/M6vU43fzbEK4 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Workaround : cache the computations,not the p= lotting itself (which should be fast,and must be made on every table, anywa= y...) :

#+options: toc:nil author:nil
* Main text

Use of a static table:

#+call: timeit()
#+call: testplot[:file te=
st0.pdf](data=3Dtable0)
#+call: timeit()

Use of a slow function:

#+call: timeit()
#+call: testplot[:file test1.pdf](data=3Dtable1)
#+call: timeit=
()

Use of a /cached/ slow function:

=
#+call: timeit()
#+call: testplot[:file test2.pdf](dat=
a=3Dtable2)
#+call: timeit()

* Annexes :=
noexport:

This is not exported, but computes resul=
ts.

#+name: timeit
#+begin_src emacs-lis=
p
  (format-time-string "%Hh %Mm %Ss")
#+end_src
<= pre>
#+name: table0
| Val | Square |
|---=
--+--------|
|   0 |      0 |
|   1 |      1 |
| 2 | 4 |
|   3 |      9 |
|   4 |     16 |
#+TBLFM: $2=3D$1^2

#+name: table1
#+begin_src emacs-lisp
  (sleep-for 5)
  (setq s ( li=
st (list "x" "x^2") 'hline))
  (dotimes (i 5 s) (setq s (append s=
 (list (cons i (list (* i i)))))))
  s
#+end_src
<= pre>
#+RESULTS[46320b31c46cef901580bad78aee7032d97ffe64]: tab=
le1
| x | x^2 |
|---+-----|
| 0 |   0 |
=
| 1 |   1 |
| 2 |   4 |
| 3 |   9 |
| 4 =
|  16 |


#+name: table2
#+=
begin_src emacs-lisp :cache yes
  (sleep-for 5)
  (setq=
 s ( list (list "x" "x^2") 'hline))
  (dotimes (i 5 s) (setq s (a=
ppend s (list (cons i (list (* i i)))))))
  s
#+end_src=

#+name: tf
| festfile.pdf ]
<=
br>
#+RESULTS[46320b31c46cef901580bad78aee7032d97ffe64]: table2
| x | x^2 |
|---+-----|
| 0 |   0 |
=
| 1 |   1 |
| 2 |   4 |
| 3 |   9 |
| 4 |  16=
 |

#+name: testplot
#+begin_src gnuplot =
:var data=3Dtable0 :exports results
  reset
  plot data=
 with linespoints
#+end_src

HTH,

--
Emmanuel Charpentier

--=-FPzuZLu/M6vU43fzbEK4--