still trying to figure out where the time goes

This commit is contained in:
Danny Yoo 2011-09-03 18:06:44 -04:00
parent 794b3a5cd7
commit 3ece0e20cd
2 changed files with 38 additions and 17 deletions

View File

@ -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)

View File

@ -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")