Permalink
Browse files

add codemirror benchmark (and fix some bugs that prevented it from ru…

…nning)
  • Loading branch information...
1 parent 1a7eef4 commit 048b184afe5f5cda793219ee4813f5b66ade94f5 @marijnh marijnh committed with Jul 18, 2010
Showing with 801 additions and 9 deletions.
  1. +20 −0 bench.lisp
  2. +769 −0 bench/codemirror.js
  3. +2 −2 inline-op.lisp
  4. +3 −4 js.lisp
  5. +2 −1 packages.lisp
  6. +3 −0 runtime.lisp
  7. +2 −2 translate.lisp
View
@@ -0,0 +1,20 @@
+(in-package :js)
+
+(defun ray ()
+ (with-js-env
+ (js-load-file (asdf:system-relative-pathname :js "bench/ray.js"))
+ (time (js-funcall (lookup *global* "renderScene")))))
+
+(defun slurp-file (file)
+ (with-open-file (in file)
+ (apply #'concatenate 'string
+ (loop :for buf := (make-string 4096) :for chars := (read-sequence buf in)
+ :if (< chars 4096) :collect (subseq buf 0 chars) :into all :and :do (return all)
+ :else :collect buf :into all))))
+
+(defun codemirror ()
+ (with-js-env
+ (let ((file (asdf:system-relative-pathname :js "bench/codemirror.js")))
+ (js-load-file file)
+ (let ((code (slurp-file file)))
+ (time (js-funcall (lookup *global* "codemirrorBench") code))))))
Oops, something went wrong.

0 comments on commit 048b184

Please sign in to comment.