From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vladimir Nikishkin Subject: Re: Bug: org-babel-expand-noweb-references is very slow [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)] Date: Thu, 9 Jan 2020 09:41:00 +0800 Message-ID: References: <87v9sr7qpn.fsf@delllaptop.lockywolf.net> <87o8yjbc9g.fsf@nicolasgoaziou.fr> <87v9sp9ejl.fsf@nicolasgoaziou.fr> <87y2ujr198.fsf@nicolasgoaziou.fr> <871rs9g8w1.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000006cf69e059bab1f33" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:50209) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipMqM-0000a5-50 for emacs-orgmode@gnu.org; Wed, 08 Jan 2020 20:42:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipMqI-0007YM-Bc for emacs-orgmode@gnu.org; Wed, 08 Jan 2020 20:42:37 -0500 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]:46950) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipMqI-0007Tb-0Z for emacs-orgmode@gnu.org; Wed, 08 Jan 2020 20:42:34 -0500 Received: by mail-ed1-x52c.google.com with SMTP id m8so4214561edi.13 for ; Wed, 08 Jan 2020 17:42:33 -0800 (PST) In-Reply-To: <871rs9g8w1.fsf@nicolasgoaziou.fr> 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-mx.org@gnu.org Sender: "Emacs-orgmode" To: Vladimir Nikishkin , emacs-orgmode@gnu.org --0000000000006cf69e059bab1f33 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ouch, that was unexpected. The manual for my version only includes four mentions if the noweb-ref header argument. Is it becoming deprecated? What does "apparently don't need" actually mean? That is, when should I use the name, and when the header argument? What can the header argument do that the name cannot? Nicolas Goaziou =E6=96=BC 2020=E5=B9=B41=E6=9C=889= =E6=97=A5 =E9=80=B1=E5=9B=9B 01:23 =E5=AF=AB=E9=81=93=EF=BC=9A > Hello, > > Vladimir Nikishkin writes: > > > I am attaching the file in which tangling is still slow. > > > > The file is quite big, but that alone doesn't seem to be the reason > > for slowliness (I tried adding 1M-long words in the random places of > > the previous mwe). > > > > You can see the result by C-c C-v C-v'ing the code block at the > > "Ramanujan numbers" heading. > > > > Below is the profiler report for C-c C-v C-v'ing.with the heaviest > > blocks expanded: > > This is because you're using :noweb-ref, which _is_ slow, although you > apparently don't need it in the document. Use name keyword instead, > e.g., > > #+name: primetest > #+begin_src scheme :exports both :results output > (define (smallest-divisor n) > (find-divisor n 2)) > (define (find-divisor n test-divisor) > (cond ((> (square test-divisor) n) n) > ((divides? test-divisor n) test-divisor) > (else (find-divisor n (+ test-divisor 1))))) > (define (divides? a b) (=3D (remainder b a) 0)) > > (define (prime? n) > (=3D n (smallest-divisor n))) > #+end_src > > > Regards, > > -- > Nicolas Goaziou > --0000000000006cf69e059bab1f33 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ouch, that was unexpected.

The manual for my version only includes four mentions i= f the noweb-ref header argument. Is it becoming deprecated?

What does "apparently don't = need" actually mean? That is, when should I use the name, and when the= header argument? What can the header argument do that the name cannot?

= Nicolas Goaziou <mail@nicolasg= oaziou.fr> =E6=96=BC 2020=E5=B9=B41=E6=9C=889=E6=97=A5 =E9=80=B1=E5= =9B=9B 01:23 =E5=AF=AB=E9=81=93=EF=BC=9A
Hello,

Vladimir Nikishkin <lockywolf@gmail.com> writes:

> I am attaching the file in which tangling is still slow.
>
> The file is quite big, but that alone doesn't seem to be the reaso= n
> for slowliness (I tried adding 1M-long words in the random places of > the previous mwe).
>
> You can see the result by C-c C-v C-v'ing the code block at the > "Ramanujan numbers" heading.
>
> Below is the profiler report for C-c C-v C-v'ing.with the heaviest=
> blocks expanded:

This is because you're using :noweb-ref, which _is_ slow, although you<= br> apparently don't need it in the document. Use name keyword instead,
e.g.,

=C2=A0 =C2=A0 #+name: primetest
=C2=A0 =C2=A0 #+begin_src scheme :exports both :results output
=C2=A0 =C2=A0 =C2=A0 (define (smallest-divisor n)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (find-divisor n 2))
=C2=A0 =C2=A0 =C2=A0 (define (find-divisor n test-divisor)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (cond ((> (square test-divisor) n) n)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((divides? test-divisor n) test-divisor)=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (else (find-divisor n (+ test-divisor 1)= ))))
=C2=A0 =C2=A0 =C2=A0 (define (divides? a b) (=3D (remainder b a) 0))

=C2=A0 =C2=A0 =C2=A0 (define (prime? n)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (=3D n (smallest-divisor n)))
=C2=A0 =C2=A0 #+end_src


Regards,

--
Nicolas Goaziou
--0000000000006cf69e059bab1f33--