From 3ece0e20cd9ea69f5a230279879d9664385a7ec1 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Sat, 3 Sep 2011 18:06:44 -0400 Subject: [PATCH] still trying to figure out where the time goes --- make/make.rkt | 44 ++++++++++++++++++++++---------- web-world/examples/todo/todo.rkt | 11 +++++--- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/make/make.rkt b/make/make.rkt index 003a44d..49f8e15 100644 --- a/make/make.rkt +++ b/make/make.rkt @@ -62,20 +62,36 @@ (values ast stmts)])))] [else - (let ([ast - (cond - [(ModuleSource? a-source) - (parse-bytecode (ModuleSource-path a-source))] - [(SexpSource? a-source) - (let ([source-code-op (open-output-bytes)]) - (write (SexpSource-sexp a-source) source-code-op) - (parse-bytecode - (open-input-bytes - (get-module-bytecode - (open-input-bytes - (get-output-bytes source-code-op))))))])]) - (values ast - (compile ast 'val next-linkage/drop-multiple)))])) + (let ([ast (get-ast a-source)]) + (define start-time (current-inexact-milliseconds)) + (define compiled-code (compile ast 'val next-linkage/drop-multiple)) + (define stop-time (current-inexact-milliseconds)) + (printf " compile ast: ~a milliseconds\n" (- stop-time start-time)) + (values ast compiled-code))])) + + + +(: get-ast ((U ModuleSource SexpSource) -> Expression)) +(define (get-ast a-source) + (define start-time (current-inexact-milliseconds)) + (: ast Expression) + (define ast (cond + [(ModuleSource? a-source) + (parse-bytecode (ModuleSource-path a-source))] + [(SexpSource? a-source) + (let ([source-code-op (open-output-bytes)]) + (write (SexpSource-sexp a-source) source-code-op) + (parse-bytecode + (open-input-bytes + (get-module-bytecode + (open-input-bytes + (get-output-bytes source-code-op))))))])) + (define stop-time (current-inexact-milliseconds)) + (printf " get-ast: ~a milliseconds\n" (- stop-time start-time)) + ast) + + + diff --git a/web-world/examples/todo/todo.rkt b/web-world/examples/todo/todo.rkt index 3e5b8ca..b950811 100644 --- a/web-world/examples/todo/todo.rkt +++ b/web-world/examples/todo/todo.rkt @@ -47,6 +47,7 @@ world)) + ;; refresh-item-in-view: item view -> view (define (refresh-item-in-view item view) (cond @@ -74,9 +75,13 @@ (define the-view - (view-bind (view-focus (->view index.html) "add-button") - "click" - on-add)) + (let* ([v1 (view-bind (view-focus (->view index.html) "add-button") + "click" + on-add)] + [v2 (view-bind (view-focus v1 "next-item") + "change" + on-add)]) + v2)) (big-bang (list (new-item "milk")