From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com>
Date: Wed, 18 Jan 2012 02:12:12 +0000 (+0530)
Subject: some measurements on evaluation with and without analysis
X-Git-Url: https://git.rkrishnan.org/simplejson/components/com_hotproperty/frontends/index.php?a=commitdiff_plain;h=6710bcc21e7da75068ff1a33bfa568fe19a32c89;p=sicp.git

some measurements on evaluation with and without analysis
---

diff --git a/src/sicp/ex4_24.rkt b/src/sicp/ex4_24.rkt
new file mode 100644
index 0000000..2a54056
--- /dev/null
+++ b/src/sicp/ex4_24.rkt
@@ -0,0 +1,87 @@
+#lang racket
+
+;;; without analysis
+
+#|
+
+> (t '(begin 
+        (define (factorial n)
+          (if (= n 1)
+              1
+              (* (factorial (- n 1)) n)))
+        (factorial 1000)))
+27.14208984375
+> (t '(begin 
+        (define (factorial n)
+          (if (= n 1)
+              1
+              (* (factorial (- n 1)) n)))
+        (factorial 1000)))
+27.64404296875
+> (t '(begin 
+        (define (factorial n)
+          (if (= n 1)
+              1
+              (* (factorial (- n 1)) n)))
+        (factorial 10000)))
+417.66796875
+> (t '(begin 
+        (define (factorial n)
+          (if (= n 1)
+              1
+              (* (factorial (- n 1)) n)))
+        (factorial 10000)))
+416.1162109375
+> (t '(begin 
+        (define (factorial n)
+          (if (= n 1)
+              1
+              (* (factorial (- n 1)) n)))
+        (factorial 10000)))
+439.837890625
+> 
+
+|#
+
+;; with analysis
+
+#|
+
+>  (t '(begin 
+        (define (factorial n)
+          (if (= n 1)
+              1
+              (* (factorial (- n 1)) n)))
+        (factorial 1000)))
+15.368896484375
+>  (t '(begin 
+        (define (factorial n)
+          (if (= n 1)
+              1
+              (* (factorial (- n 1)) n)))
+        (factorial 1000)))
+15.39111328125
+>  (t '(begin 
+        (define (factorial n)
+          (if (= n 1)
+              1
+              (* (factorial (- n 1)) n)))
+        (factorial 10000)))
+298.23779296875
+>  (t '(begin 
+        (define (factorial n)
+          (if (= n 1)
+              1
+              (* (factorial (- n 1)) n)))
+        (factorial 10000)))
+252.77978515625
+>  (t '(begin 
+        (define (factorial n)
+          (if (= n 1)
+              1
+              (* (factorial (- n 1)) n)))
+        (factorial 10000)))
+255.87890625
+> 
+
+|#
\ No newline at end of file