From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou 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: Wed, 08 Jan 2020 18:23:10 +0100 Message-ID: <871rs9g8w1.fsf@nicolasgoaziou.fr> References: <87v9sr7qpn.fsf@delllaptop.lockywolf.net> <87o8yjbc9g.fsf@nicolasgoaziou.fr> <87v9sp9ejl.fsf@nicolasgoaziou.fr> <87y2ujr198.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:46151) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipF37-0001AP-Gm for emacs-orgmode@gnu.org; Wed, 08 Jan 2020 12:23:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipF36-0001D1-27 for emacs-orgmode@gnu.org; Wed, 08 Jan 2020 12:23:16 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:38417) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ipF35-00019j-SV for emacs-orgmode@gnu.org; Wed, 08 Jan 2020 12:23:16 -0500 In-Reply-To: (Vladimir Nikishkin's message of "Wed, 8 Jan 2020 10:18:51 +0800") 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 Cc: emacs-orgmode@gnu.org 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) (= (remainder b a) 0)) (define (prime? n) (= n (smallest-divisor n))) #+end_src Regards, -- Nicolas Goaziou