In Native Clojure with GraalVM the "jq" example runs in about 0.1 second using GraalVM.
I'm not building the GraalVM solution for an accurate comparison, but below is the same using Planck (on a box with potentially different perf characteristics).
Porting to Planck (by adding [planck.core :refer [*in* read read-string]]
) shows that the GraalVM approach is much faster. Planck is taking about 0.85 seconds and even around 0.68 seconds if you cache simple-optimized code:
src/pprintin/main.cljs
:
(ns pprintin.main
(:require [clojure.pprint :refer [pprint]]
[planck.core :refer [*in* read read-string]]))
(defn -main [& path]
(-> (read *in*)
(get-in (mapv read-string path))
pprint))
$ time plk -m pprintin.main :files 1 :lines <<eof
> {:files
> [{:name "src/core.clj"
> :added #inst "2018-04-01"
> :id #uuid "38f533db-eebb-4186-bc79-4bb777e67df7"
> :lines {:code 17
> :comments 3
> :blank 4}}
> {:name "src/internals.clj"
> :added #inst "2018-04-05"
> :id #uuid "55fbc5f3-adcb-4439-af4e-10a6f321da02"
> :lines {:code 43
> :comments 0
> :blank 11}}]}
> eof
{:code 43, :comments 0, :blank 11}
real 0m0.853s
user 0m1.124s
sys 0m0.099s
Trying to make things run faster with caching, etc:
$ time planck -c src -O simple -K -m pprintin.main :files 1 :lines <<eof
> {:files
> [{:name "src/core.clj"
> :added #inst "2018-04-01"
> :id #uuid "38f533db-eebb-4186-bc79-4bb777e67df7"
> :lines {:code 17
> :comments 3
> :blank 4}}
> {:name "src/internals.clj"
> :added #inst "2018-04-05"
> :id #uuid "55fbc5f3-adcb-4439-af4e-10a6f321da02"
> :lines {:code 43
> :comments 0
> :blank 11}}]}
> eof
{:code 43, :comments 0, :blank 11}
real 0m0.679s
user 0m0.941s
sys 0m0.066s