* bug#21765: 24.5; Profiler innefective for recursive functions
@ 2015-10-26 17:47 Jonathan H
0 siblings, 0 replies; only message in thread
From: Jonathan H @ 2015-10-26 17:47 UTC (permalink / raw)
To: 21765
[-- Attachment #1: Type: text/plain, Size: 563 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 779 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-10-26 17:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-26 17:47 bug#21765: 24.5; Profiler innefective for recursive functions Jonathan H
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.