GNU bug report logs - #21765
24.5; Profiler innefective for recursive functions

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Jonathan H <pythonnut@HIDDEN>; dated Mon, 26 Oct 2015 17:48:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Oct 2015 17:47:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 26 13:47:57 2015
Received: from localhost ([127.0.0.1]:39371 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZqlsD-0004eJ-10
	for submit <at> 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 <pythonnut@HIDDEN>) id 1Zqlrt-0004dt-KH
 for submit <at> 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 <pythonnut@HIDDEN>) id 1Zqlrs-000451-H8
 for submit <at> 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 <pythonnut@HIDDEN>) id 1Zqlrs-00044w-E4
 for submit <at> 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 <pythonnut@HIDDEN>) id 1Zqlrr-0001hJ-8V
 for bug-gnu-emacs@HIDDEN; Mon, 26 Oct 2015 13:47:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <pythonnut@HIDDEN>) id 1Zqlrn-000432-F2
 for bug-gnu-emacs@HIDDEN; 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 <pythonnut@HIDDEN>) id 1Zqlrn-00042q-9j
 for bug-gnu-emacs@HIDDEN; Mon, 26 Oct 2015 13:47:31 -0400
Received: by iodd200 with SMTP id d200so31641647iod.0
 for <bug-gnu-emacs@HIDDEN>; 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 <pythonnut@HIDDEN>
Date: Mon, 26 Oct 2015 10:47:01 -0700
Message-ID: <CAAW2-ZeCiD27dPe47JC=ZM-cyVZVjecgmhuDnaTFOeqbjH2VjQ@HIDDEN>
Subject: 24.5; Profiler innefective for recursive functions
To: bug-gnu-emacs@HIDDEN
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 <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
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

<div dir=3D"ltr">The Emacs profiler cannot be used to effectively profile, =
because the reports do not flatten the recursion.<br><div><div><div><br></d=
iv><div>Take for example, this recipie:<br></div><div><br></div><div>;; Nai=
ve Fibonacci has terrible time complexity. <br></div><div>(defun fib (n)<br=
>=C2=A0 (if (&lt; n 3)<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1<br>=C2=A0=C2=A0=
=C2=A0 (+ (fib (- n 1))<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (fib (- n 2=
)))))<br><br>(profiler-start &#39;cpu)<br>(fib 30)<br>(profiler-report)<br>=
(profiler-stop)<br><br></div><div>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.<br><br></div><div>Thanks,<br></div><div>PythonNut<br></div></d=
iv></div></div>

--001a1142d85e2bbdf00523058e41--




Acknowledgement sent to Jonathan H <pythonnut@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#21765; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.