BetterThanTomorrow / joyride

Making VS Code Hackable like Emacs since 2022
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.joyride
Other
469 stars 17 forks source link

Add `time` macro #169

Open PEZ opened 1 year ago

PEZ commented 1 year ago

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.