aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorGlenn Morris2012-11-20 00:02:54 -0800
committerGlenn Morris2012-11-20 00:02:54 -0800
commit5b776637e1facf949c9bc0db665db879c580e2f6 (patch)
tree629a0a1c2af519dbef732a68c22e9379e687779a /doc
parent63f251724c324fc04d987877d06ca62ac1735b0a (diff)
downloademacs-5b776637e1facf949c9bc0db665db879c580e2f6.tar.gz
emacs-5b776637e1facf949c9bc0db665db879c580e2f6.zip
Make a start on a Profiling section in the lispref
* doc/lispref/debugging.texi (Profiling): New section, in progress. * doc/lispref/tips.texi (Compilation Tips): Move profiling to separate section. * doc/lispref/elisp.texi: Add Profiling to detailed menu.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/ChangeLog6
-rw-r--r--doc/lispref/debugging.texi40
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/tips.texi14
4 files changed, 49 insertions, 12 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index bdf4ef13488..9d71d4b4420 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,9 @@
12012-11-20 Glenn Morris <rgm@gnu.org>
2
3 * debugging.texi (Profiling): New section, in progress.
4 * tips.texi (Compilation Tips): Move profiling to separate section.
5 * elisp.texi: Add Profiling to detailed menu.
6
12012-11-18 Martin Rudalics <rudalics@gmx.at> 72012-11-18 Martin Rudalics <rudalics@gmx.at>
2 8
3 * windows.texi (Display Action Functions): Fix recently added 9 * windows.texi (Display Action Functions): Fix recently added
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 11532b19781..53d739f2295 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -43,6 +43,7 @@ function (@pxref{Terminal Output}).
43* Edebug:: A source-level Emacs Lisp debugger. 43* Edebug:: A source-level Emacs Lisp debugger.
44* Syntax Errors:: How to find syntax errors. 44* Syntax Errors:: How to find syntax errors.
45* Test Coverage:: Ensuring you have tested all branches in your code. 45* Test Coverage:: Ensuring you have tested all branches in your code.
46* Profiling:: Measuring the resources that your code uses.
46@end menu 47@end menu
47 48
48@node Debugger 49@node Debugger
@@ -809,3 +810,42 @@ never return. If it ever does return, you get a run-time error.
809 Edebug also has a coverage testing feature (@pxref{Coverage 810 Edebug also has a coverage testing feature (@pxref{Coverage
810Testing}). These features partly duplicate each other, and it would 811Testing}). These features partly duplicate each other, and it would
811be cleaner to combine them. 812be cleaner to combine them.
813
814
815@node Profiling
816@section Profiling
817@cindex profiling
818@cindex measuring resource usage
819@cindex memory usage
820
821If your program is working correctly, but you want to make it run more
822quickly or efficiently, the first thing to do is @dfn{profile} your
823code that you know how it is using resources. If you find that one
824particular function is responsible for a significant portion of the
825runtime, you can start by looking for ways to optimize that piece.
826
827Emacs has built-in support for this. To begin profiling, type
828@kbd{M-x profiler-start}. You can choose to profile by processor
829usage, memory usage, or both. After doing some work, type
830@kbd{M-x profiler-report} to display a summary buffer for each
831resource that you chose to profile. The names of the report buffers
832include the times at which the reports were generated, so you can
833generate another report later on without erasing previous results.
834When you have finished profiling, type @kbd{M-x profiler-stop} (there
835is a small overhead associated with profiling).
836
837@c FIXME
838@c Basic apperance of the report buffer:
839
840@c The following commands are available in the report buffer:
841
842@cindex @file{elp.el}
843@cindex timing programs
844The @file{elp} library offers an alternative approach. See the file
845@file{elp.el} for instructions.
846
847@cindex @file{benchmark.el}
848@cindex benchmarking
849You can check the speed of individual Emacs Lisp forms using the
850@file{benchmark} library. See the functions @code{benchmark-run} and
851@code{benchmark-run-compiled} in @file{benchmark.el}.
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index a70558bf09f..cb00b5e9889 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -617,6 +617,7 @@ Debugging Lisp Programs
617* Edebug:: A source-level Emacs Lisp debugger. 617* Edebug:: A source-level Emacs Lisp debugger.
618* Syntax Errors:: How to find syntax errors. 618* Syntax Errors:: How to find syntax errors.
619* Test Coverage:: Ensuring you have tested all branches in your code. 619* Test Coverage:: Ensuring you have tested all branches in your code.
620* Profiling:: Measuring the resources that your code uses.
620 621
621The Lisp Debugger 622The Lisp Debugger
622 623
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index 4336baa128f..bba416d5614 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -460,18 +460,8 @@ Lisp programs.
460 460
461@itemize @bullet 461@itemize @bullet
462@item 462@item
463@cindex profiling 463Profile your program, to find out where the time is being spent.
464@cindex timing programs 464@xref{Profiling}.
465@cindex @file{elp.el}
466Profile your program with the @file{elp} library. See the file
467@file{elp.el} for instructions.
468
469@item
470@cindex @file{benchmark.el}
471@cindex benchmarking
472Check the speed of individual Emacs Lisp forms using the
473@file{benchmark} library. See the functions @code{benchmark-run} and
474@code{benchmark-run-compiled} in @file{benchmark.el}.
475 465
476@item 466@item
477Use iteration rather than recursion whenever possible. 467Use iteration rather than recursion whenever possible.