comparison man/lispref/compile.texi @ 219:262b8bb4a523 r20-4b8

Import from CVS: tag r20-4b8
author cvs
date Mon, 13 Aug 2007 10:09:35 +0200
parents d44af0c54775
children 70ad99077275
comparison
equal deleted inserted replaced
218:c9f226976f56 219:262b8bb4a523
58 (list t1 (current-time-string)))) 58 (list t1 (current-time-string))))
59 @result{} silly-loop 59 @result{} silly-loop
60 @end group 60 @end group
61 61
62 @group 62 @group
63 (silly-loop 100000) 63 (silly-loop 5000000)
64 @result{} ("Fri Mar 18 17:25:57 1994" 64 @result{} ("Fri Nov 28 20:56:16 1997"
65 "Fri Mar 18 17:26:28 1994") ; @r{31 seconds} 65 "Fri Nov 28 20:56:39 1997") ; @r{23 seconds}
66 @end group 66 @end group
67 67
68 @group 68 @group
69 (byte-compile 'silly-loop) 69 (byte-compile 'silly-loop)
70 @result{} #<compiled-function ...> 70 @result{} #<compiled-function
71 @end group 71 (from "loadup.el")
72 72 (n)
73 @group 73 "...(23)"
74 (silly-loop 100000) 74 [current-time-string t1 n 0]
75 @result{} ("Fri Mar 18 17:26:52 1994" 75 2
76 "Fri Mar 18 17:26:58 1994") ; @r{6 seconds} 76 "Return time before and after N iterations of a loop.">
77 @end group
78
79 @group
80 (silly-loop 5000000)
81 @result{} ("Fri Nov 28 20:57:49 1997"
82 "Fri Nov 28 20:57:55 1997") ; @r{6 seconds}
77 @end group 83 @end group
78 @end example 84 @end example
79 85
80 In this example, the interpreted code required 31 seconds to run, 86 In this example, the interpreted code required 23 seconds to run,
81 whereas the byte-compiled code required 6 seconds. These results are 87 whereas the byte-compiled code required 6 seconds. These results are
82 representative, but actual results will vary greatly. 88 representative, but actual results will vary greatly.
83 89
84 @node Compilation Functions 90 @node Compilation Functions
85 @comment node-name, next, previous, up 91 @comment node-name, next, previous, up
132 @result{} factorial 138 @result{} factorial
133 @end group 139 @end group
134 140
135 @group 141 @group
136 (byte-compile 'factorial) 142 (byte-compile 'factorial)
137 @result{} 143 @result{} #<compiled-function
138 #<compiled-function (integer) 144 (from "loadup.el")
139 "ÁU«‚Á‡ÂS!_‡" 145 (integer)
140 [integer 1 factorial] 146 "...(21)"
141 3 "Compute factorial of INTEGER."> 147 [integer 1 factorial]
148 3
149 "Compute factorial of INTEGER.">
142 @end group 150 @end group
143 @end example 151 @end example
144 152
145 @noindent 153 @noindent
146 The result is a compiled-function object. The string it contains is 154 The result is a compiled-function object. The string it contains is
461 representation. It is the definition of the command 469 representation. It is the definition of the command
462 @code{backward-sexp}. 470 @code{backward-sexp}.
463 471
464 @example 472 @example
465 #<compiled-function 473 #<compiled-function
466 (&optional arg) 474 (from "lisp.elc")
467 "¬‚ÁÂ[!‡" 475 (&optional arg)
468 [arg 1 forward-sexp] 476 "...(15)" [arg 1 forward-sexp] 2 854740 "_p">
469 2
470 579173
471 "_p">
472 @end example 477 @end example
473 478
474 The primitive way to create a compiled-function object is with 479 The primitive way to create a compiled-function object is with
475 @code{make-byte-code}: 480 @code{make-byte-code}:
476 481