sci: performance improvement

This commit is contained in:
Michiel Borkent 2020-01-14 17:12:57 +01:00 committed by GitHub
parent c71cfa637a
commit bfa8b45e34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 4 deletions

View file

@ -9,4 +9,10 @@
org.clojure/data.csv {:mvn/version "0.1.4"},
cheshire {:mvn/version "5.9.0"}}
:aliases {:main
{:main-opts ["-m" "babashka.main"]}}}
{:main-opts ["-m" "babashka.main"]}
:profile
{:extra-deps
{com.clojure-goes-fast/clj-async-profiler {:mvn/version "0.4.0"}}
:extra-paths ["test"]
:jvm-opts ["-Djdk.attach.allowAttachSelf"]
:main-opts ["-m" "babashka.profile"]}}}

2
sci

@ -1 +1 @@
Subproject commit 381a158f72c1efbb8e48229bc67c7a109dffe7c0
Subproject commit 6a63e4212567ad0304a88094eeb2970317d0bfd8

View file

@ -107,8 +107,8 @@
(if (some opts-map [:file :socket-repl :expression :main])
(assoc opts-map
:command-line-args options)
(let [opt (str/triml opt)
c (.charAt opt 0)]
(let [trimmed-opt (str/triml opt)
c (.charAt trimmed-opt 0)]
(case c
(\( \{ \[ \* \@ \#)
(assoc opts-map

12
test/babashka/profile.clj Normal file
View file

@ -0,0 +1,12 @@
(ns babashka.profile
(:require [babashka.main :as main]))
(comment)
;; clojure -A:profile -e "(prn (loop [val 0 cnt 1000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val)))"
#_(require '[clj-async-profiler.core :as prof])
(defn -main [& options]
#_(prof/profile (apply main/main options))
(shutdown-agents))