This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-18
Channels
- # announcements (43)
- # aws (28)
- # babashka (32)
- # beginners (80)
- # calva (13)
- # chlorine-clover (2)
- # cider (11)
- # clj-kondo (15)
- # cljs-dev (1)
- # clojure (151)
- # clojure-dev (11)
- # clojure-europe (11)
- # clojure-italy (3)
- # clojure-losangeles (3)
- # clojure-nl (4)
- # clojure-spec (20)
- # clojure-uk (58)
- # clojured (3)
- # clojuredesign-podcast (2)
- # clojurescript (37)
- # core-async (4)
- # core-typed (1)
- # cursive (53)
- # datascript (5)
- # datomic (26)
- # duct (23)
- # emacs (3)
- # fulcro (22)
- # graalvm (1)
- # jobs (2)
- # joker (11)
- # juxt (24)
- # lumo (1)
- # mid-cities-meetup (2)
- # nyc (1)
- # off-topic (54)
- # parinfer (1)
- # reagent (13)
- # shadow-cljs (16)
- # sql (9)
- # tree-sitter (9)
- # vim (9)
$ clj -e '(ns foo "an awesome namespace" (:require [clojure.repl])) (clojure.repl/doc foo)'
-------------------------
foo
an awesome namespace
$ bb -e '(ns foo "an awesome namespace" (:require [clojure.repl])) (clojure.repl/doc foo)'
-------------------------
foo
an awesome namespace
Hi. Is there any way to read keypresses using Babashka in a Linux/Mac terminal? With Clojure on the JVM I set the terminal to RAW mode and I do something like this:
(let [r (.BufferedReader. *in*)]
(loop [input (.read r)]
(do something with input)
(recur (.read r))))
How do you set the terminal to raw mode? I test this code:
(let [r (.BufferedReader. *in*)]
(loop [input (.read r)]
(prn input)
(recur (.read r))))
with
clojure /tmp/foo.clj
and nothing happens until I press enterI usually use ProcessBuilder in Java to execute
stty -echo raw </dev/tty
If I just add that to the command line it actually works :-) Something like
stty -echo raw </dev/tty ; bb /tmp/foo.clj
I do not know why I did not see this. I am good to go. Thank you!
Now I will try to make my text editor work through Babashka :-)
@U0FS3RG3C was also interested in reading single characters at a time, so stex ^
There is an issue with the new version 20 of GraalVM on macOS: the startup time seems to be 10ms slower (which makes it 25ms instead of 13ms). Is this a problem to anyone? I don't find it very noticeable, unless you start like 100 bb scripts in sequence.
Is there a new feature that wants you to do the update anyway? I don't notice any different between 13ms and 25ms. I guess it doesn't affect the runtime performance (slower loops or similar)?
let me check. it does seem a little slower with v20:
$ time ./bb "(loop [val 0 cnt 1000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val))"
1000000
./bb 1.98s user 0.10s system 99% cpu 2.089 total
I'm recompiling with 19.3.1 now...with 19.3.1:
$ time ./bb "(loop [val 0 cnt 1000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val))"
1000000
./bb 1.59s user 0.08s system 99% cpu 1.676 total
Would be good if someone could also test this loop on linux for 19.3.1 vs 20 - maybe @sogaiu?
thanks! I updated the issue here: https://github.com/oracle/graal/issues/2136#issuecomment-587941241 once you have this data for linux, I'll also paste it there, unless you want to yourself
Upgrading to v20 would open up the possibility for jdk11 which would then maybe open up the way to a built-in http client (hato, which I haven't tested yet)
jdk11 has problems on 19.3.1 for macos when using nio classes in the reflection.config which babashka does, that's why we cannot upgrade to jdk11 with 19.3.1 right now
luckily graalvm is now providing dev builds so maybe the wait isn't that long once this is fixed
it's nice there are snapshots / nightlies -- good for testing whether something is fixed. not so sure if they will be good for building releases -- perhaps it will depend.
you might be right... on the other hand, production releases also often contain bugs, so what's the difference 🙂
downloads keep dying...i don't suppose there is some way to get checksums for github releases?
19.3.1:
$ multitime -n10 -s1 -q ./bb "(loop [val 0 cnt 1000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val))"
===> multitime results
1: -q ./bb "(loop [val 0 cnt 1000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val))"
Mean Std.Dev. Min Median Max
real 1.785 0.037 1.737 1.780 1.873
user 1.709 0.039 1.653 1.716 1.797
sys 0.076 0.015 0.040 0.080 0.092
20.0.0:
$ multitime -n10 -s1 -q ./bb "(loop [val 0 cnt 1000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val))"
===> multitime results
1: -q ./bb "(loop [val 0 cnt 1000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val))"
Mean Std.Dev. Min Median Max
real 1.897 0.055 1.837 1.872 1.988
user 1.819 0.044 1.762 1.800 1.889
sys 0.078 0.015 0.052 0.078 0.100