Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time macro #169

Open
PEZ opened this issue Oct 30, 2023 · 0 comments
Open

Add time macro #169

PEZ opened this issue Oct 30, 2023 · 0 comments

Comments

@PEZ
Copy link
Collaborator

PEZ commented Oct 30, 2023

Joyride doesn't come with the time macro. nbb has this:

(defmacro time
  "Async version of time."
  [expr]
  `(let [start# (cljs.core/system-time)
         ret# ~expr
         ret# (js/Promise.resolve ret#)]
     (nbb.core/await
      (.then ret# (fn [v#]
                    (prn (cljs.core/str "Elapsed time: "
                                        (.toFixed (- (cljs.core/system-time) start#) 6)
                                        " msecs"))
                    v#)))))

Anyway, @borkdude thinks SCI should have it, so that is probably the best way to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant