From e9403bb6364152af447080d41a35891f8d75ff30 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 17 Mar 2019 00:15:52 -0400 Subject: Now only timing compiler operations in the Leiningen plugin. --- lux-lein/src/leiningen/lux/builder.clj | 10 +++++----- lux-lein/src/leiningen/lux/packager.clj | 2 +- lux-lein/src/leiningen/lux/test.clj | 18 +++++++++--------- luxc/src/lux.clj | 2 +- stdlib/source/program/compositor.lux | 15 --------------- 5 files changed, 16 insertions(+), 31 deletions(-) diff --git a/lux-lein/src/leiningen/lux/builder.clj b/lux-lein/src/leiningen/lux/builder.clj index eeb1cead7..ebfbc7895 100644 --- a/lux-lein/src/leiningen/lux/builder.clj +++ b/lux-lein/src/leiningen/lux/builder.clj @@ -6,10 +6,10 @@ (defn build [project] (if-let [program-module (get-in project [:lux :program])] - (when (&utils/run-process (&utils/compile-path project program-module (get project :source-paths (list))) - nil - "[COMPILATION BEGAN]" - "[COMPILATION ENDED]") - (&packager/package project program-module (get project :resource-paths (list))) + (when (time (&utils/run-process (&utils/compile-path project program-module (get project :source-paths (list))) + nil + "[COMPILATION BEGAN]" + "[COMPILATION ENDED]")) + (time (&packager/package project program-module (get project :resource-paths (list)))) true) (println missing-module-error))) diff --git a/lux-lein/src/leiningen/lux/packager.clj b/lux-lein/src/leiningen/lux/packager.clj index eafa4ed06..7f80b1763 100644 --- a/lux-lein/src/leiningen/lux/packager.clj +++ b/lux-lein/src/leiningen/lux/packager.clj @@ -231,4 +231,4 @@ (defn package "(-> Text Text (List Text) Null)" [project module resources-dirs] - (time (package-jvm project module resources-dirs))) + (package-jvm project module resources-dirs)) diff --git a/lux-lein/src/leiningen/lux/test.clj b/lux-lein/src/leiningen/lux/test.clj index 3ecfcbe6e..84ba33d58 100644 --- a/lux-lein/src/leiningen/lux/test.clj +++ b/lux-lein/src/leiningen/lux/test.clj @@ -8,19 +8,19 @@ (defn test [project] (if-let [test-module (get-in project [:lux :test])] - (when (&utils/run-process (&utils/compile-path project test-module (concat (:test-paths project) (:source-paths project))) - nil - "[COMPILATION BEGAN]" - "[COMPILATION ENDED]") + (when (time (&utils/run-process (&utils/compile-path project test-module (concat (:test-paths project) (:source-paths project))) + nil + "[COMPILATION BEGAN]" + "[COMPILATION ENDED]")) (let [java-cmd (get project :java-cmd "java") jvm-opts (->> (get project :jvm-opts) (interpose " ") (reduce str "")) output-package (str (get project :target-path &utils/default-target-dir) java.io.File/separator (get project :jar-name &utils/output-package))] - (do (&packager/package project test-module (get project :resource-paths (list))) - (&utils/run-process (str java-cmd " " jvm-opts " -jar " output-package) - nil - "[TESTING BEGAN]" - "[TESTING ENDED]") + (do (time (&packager/package project test-module (get project :resource-paths (list)))) + (time (&utils/run-process (str java-cmd " " jvm-opts " -jar " output-package) + nil + "[TESTING BEGAN]" + "[TESTING ENDED]")) true))) (println missing-module-error))) diff --git a/luxc/src/lux.clj b/luxc/src/lux.clj index 3dbc819a1..f35373fa8 100644 --- a/luxc/src/lux.clj +++ b/luxc/src/lux.clj @@ -20,7 +20,7 @@ (defn -main [& args] (|case (&/->list args) (&/$Cons "release" (&/$Cons program-module (&/$Cons resources-dirs (&/$Cons source-dirs (&/$Cons target-dir (&/$Nil)))))) - (time (&compiler/compile-program &/$Build program-module (separate-paths resources-dirs) (separate-paths source-dirs) target-dir)) + (&compiler/compile-program &/$Build program-module (separate-paths resources-dirs) (separate-paths source-dirs) target-dir) (&/$Cons "repl" (&/$Cons resources-dirs (&/$Cons source-dirs (&/$Cons target-dir (&/$Nil))))) (&repl/repl (separate-paths resources-dirs) diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 5fb90837f..3c4d2015c 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -44,20 +44,6 @@ (#error.Success output) (wrap output)))) -(def: (timed action) - (All [a] - (-> (-> Any (IO (Error a))) (IO (Error a)))) - (do (error.with io.monad) - [start (: (IO (Error Instant)) - (error.lift io.monad instant.now)) - result (action []) - finish (: (IO (Error Instant)) - (error.lift io.monad instant.now)) - #let [elapsed-time (instant.span start finish) - _ (log! (format text.new-line - "Elapsed time: " (%duration elapsed-time)))]] - (wrap result))) - (def: #export (compiler expander platform bundle service) (All [anchor expression statement] (-> Expander @@ -71,7 +57,6 @@ (case service (#cli.Compilation configuration) (<| (or-crash! "Compilation failed:") - ..timed (function (_ _) (do (error.with io.monad) [state (:share [anchor expression statement] -- cgit v1.2.3