From unknown Sat Jun 21 03:08:32 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#21765 <21765@debbugs.gnu.org> To: bug#21765 <21765@debbugs.gnu.org> Subject: Status: 24.5; Profiler innefective for recursive functions Reply-To: bug#21765 <21765@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:08:32 +0000 retitle 21765 24.5; Profiler innefective for recursive functions reassign 21765 emacs submitter 21765 Jonathan H severity 21765 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 26 13:47:57 2015 Received: (at submit) by debbugs.gnu.org; 26 Oct 2015 17:47:57 +0000 Received: from localhost ([127.0.0.1]:39371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZqlsD-0004eJ-10 for submit@debbugs.gnu.org; Mon, 26 Oct 2015 13:47:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59623) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zqlrt-0004dt-KH for submit@debbugs.gnu.org; Mon, 26 Oct 2015 13:47:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zqlrs-000451-H8 for submit@debbugs.gnu.org; Mon, 26 Oct 2015 13:47:37 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zqlrs-00044w-E4 for submit@debbugs.gnu.org; Mon, 26 Oct 2015 13:47:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zqlrr-0001hJ-8V for bug-gnu-emacs@gnu.org; Mon, 26 Oct 2015 13:47:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zqlrn-000432-F2 for bug-gnu-emacs@gnu.org; Mon, 26 Oct 2015 13:47:35 -0400 Received: from mail-io0-x22d.google.com ([2607:f8b0:4001:c06::22d]:33071) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zqlrn-00042q-9j for bug-gnu-emacs@gnu.org; Mon, 26 Oct 2015 13:47:31 -0400 Received: by iodd200 with SMTP id d200so31641647iod.0 for ; Mon, 26 Oct 2015 10:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=w5b2cfxU2+5U/JKX2qz+/eZaZJmIo81x3OoPtKAdZIY=; b=wImJiZODQ+eA18ogehfWMumgnqSZX+mAbuIcKbML8EGuYCM3L809dh+IQjNZJMfr9v D5UQ0nt72Hmdnf8EIREzbMRq76oV5V6Ct7Q2nJh+x9r+UrAQ4CJ8a294ic+W9gPkMlB4 PLC06zH6X8+XXmrXo5HcBscjiuArAsJZbnEKGnSzdnn78lh/aF75xX3DP44BXXI5F3xP SsQxtcpDZeTJ2z6z2+JVSwzsjLu6EL74ZBBW1AX7J1cM3DhtbdWmbZaPTeV0wNm1vNce /RaU9KxG3Govk/eOmRPVusy2QrfwBmWX5dOEXQ2rVEagYdL3jwiBRstD1S6fmn05tNHs cE5Q== X-Received: by 10.107.170.33 with SMTP id t33mr38039068ioe.70.1445881650591; Mon, 26 Oct 2015 10:47:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.79.5 with HTTP; Mon, 26 Oct 2015 10:47:01 -0700 (PDT) From: Jonathan H Date: Mon, 26 Oct 2015 10:47:01 -0700 Message-ID: Subject: 24.5; Profiler innefective for recursive functions To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=001a1142d85e2bbdf00523058e41 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --001a1142d85e2bbdf00523058e41 Content-Type: text/plain; charset=UTF-8 The Emacs profiler cannot be used to effectively profile, because the reports do not flatten the recursion. Take for example, this recipie: ;; Naive Fibonacci has terrible time complexity. (defun fib (n) (if (< n 3) 1 (+ (fib (- n 1)) (fib (- n 2))))) (profiler-start 'cpu) (fib 30) (profiler-report) (profiler-stop) Here, The profiler report assigns (nearly) all of the time to (+ ...), including time from deeper invocations of fib (and their invocations of (+ ...), which makes the profiling report less-than-optimal. Thanks, PythonNut --001a1142d85e2bbdf00523058e41 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
The Emacs profiler cannot be used to effectively profile, = because the reports do not flatten the recursion.

Take for example, this recipie:

;; Nai= ve Fibonacci has terrible time complexity.
(defun fib (n)=C2=A0 (if (< n 3)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1
=C2=A0=C2=A0= =C2=A0 (+ (fib (- n 1))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (fib (- n 2= )))))

(profiler-start 'cpu)
(fib 30)
(profiler-report)
= (profiler-stop)

Here, The profiler report assigns (nearly= ) all of the time to (+ ...), including time from deeper invocations of fib= (and their invocations of (+ ...), which makes the profiling report less-t= han-optimal.

Thanks,
PythonNut
--001a1142d85e2bbdf00523058e41--