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

Previous Next

Package: emacs;

Reported by: Jonathan H <pythonnut <at> gmail.com>

Date: Mon, 26 Oct 2015 17:48:01 UTC

Severity: normal

Found in version 24.5

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jonathan H <pythonnut <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; Profiler innefective for recursive functions
Date: Mon, 26 Oct 2015 10:47:01 -0700
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/html, inline)]

This bug report was last modified 9 years and 240 days ago.

Previous Next


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