/[guile]/guile/guile-core/lang/elisp/example.el
ViewVC logotype

Diff of /guile/guile-core/lang/elisp/example.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by ossau, Tue Jan 22 23:46:01 2002 UTC revision 1.3 by ossau, Fri Feb 8 11:50:51 2002 UTC
# Line 8  Line 8 
8            (apply 'concat contents)            (apply 'concat contents)
9            "</BODY>\n"            "</BODY>\n"
10            "</HTML>\n"))            "</HTML>\n"))
11    
12    (defmacro time (repeat-count &rest body)
13      `(let ((count ,repeat-count)
14             (beg (current-time))
15             end)
16         (while (> count 0)
17           (setq count (- count 1))
18           ,@body)
19         (setq end (current-time))
20         (+ (* 1000000.0 (+ (* 65536.0 (- (car end) (car beg)))
21                            (- (cadr end) (cadr beg))))
22            (* 1.0 (- (caddr end) (caddr beg))))))
23    
24    ;Non-scientific performance measurements (Guile measurements are with
25    ;`guile -q --no-debug'):
26    ;
27    ;(time 100000 (+ 3 4))
28    ; => 225,071 (Emacs) 4,000,000 (Guile)
29    ;(time 100000 (lambda () 1))
30    ; => 2,410,456 (Emacs) 4,000,000 (Guile)
31    ;(time 100000 (apply 'concat (mapcar (lambda (s) (concat s "." s)) '("a" "b" "c" "d"))))
32    ; => 10,185,792 (Emacs) 136,000,000 (Guile)
33    ;(defun sc (s) (concat s "." s))
34    ;(time 100000 (apply 'concat (mapcar 'sc  '("a" "b" "c" "d"))))
35    ; => 7,870,055 (Emacs) 26,700,000 (Guile)
36    ;
37    ;Sadly, it looks like the translator's performance sucks quite badly
38    ;when compared with Emacs.  But the translator is still very new, so
39    ;there's probably plenty of room of improvement.

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26