This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-01
Channels
- # adventofcode (2)
- # announcements (3)
- # babashka-sci-dev (79)
- # beginners (76)
- # biff (2)
- # calva (32)
- # cider (2)
- # clj-kondo (42)
- # clj-on-windows (17)
- # clojure (28)
- # clojure-belgium (1)
- # clojure-berlin (1)
- # clojure-europe (95)
- # clojure-nl (4)
- # clojure-norway (4)
- # clojure-uk (5)
- # clojurescript (27)
- # conjure (5)
- # cursive (3)
- # data-science (16)
- # datomic (67)
- # graalvm (12)
- # hyperfiddle (36)
- # jobs (3)
- # jobs-discuss (1)
- # kaocha (2)
- # klipse (1)
- # leiningen (28)
- # lsp (16)
- # luminus (3)
- # malli (10)
- # nrepl (3)
- # off-topic (57)
- # other-languages (18)
- # re-frame (4)
- # reitit (8)
- # releases (1)
- # remote-jobs (1)
- # scittle (4)
- # shadow-cljs (7)
- # test-check (1)
- # tools-deps (4)
- # vim (11)
- # xtdb (25)
Shouldn't last
be much faster on vectors? At least that is what I remembered to read. I did some basic benchmarking and fail to understand my results.
user=> (def r (doall (range 1e+7)))
#'user/r
user=> (let [v (vec r)]
#_=> (time (last v))
#_=> (time (last r)))
"Elapsed time: 387.154079 msecs"
"Elapsed time: 157.53812 msecs"
9999999
user=> (let [v (vec r)]
#_=> (time (last r))
#_=> (time (last v)))
"Elapsed time: 277.38866 msecs"
"Elapsed time: 559.517154 msecs"
9999999
I realized range
, so that I really deal on the data instead of the realization. However, using last
on a list
seems to be way faster than on the preallocated vector
. Does anyone have an explanation for that?
On the contrary - last
doesn't check its argument's concrete type, so it traverses the whole structure.
What's faster for vectors is peek
.
Oh! So I misunderstood. Then why is it much slower to traverse the vector
?
https://gist.github.com/reborg/dc8b0c96c397a56668905e2767fd697f#why-cannot-last-be-fast-on-vector
Btw by using 1e+7 (a double) you get the nonoptimized version of range that works on longs
you also want to run these many times to avoid jvm jit effects
I’m expecting that the wild variations in time are due to the JVM effects. https://github.com/hugoduncan/criterium is ideal for this (documentation on the page)
is there a way to “bake-in” a java argument when building an uberjar? I want to basically have java -jar mything.jar
turn into java -jar -DsomeSetting=thing mything.jar
. I tried setting the system property from the first clojure ns that gets loaded, but it behaves differently when I do that
@U051GFP2V It seems that you can do it using jDeploy: https://www.jdeploy.com/docs/manual/#_runtime_arguments
jdeploy also serves a bit of a different purpose as its output isn't a jar file, which may be a dealbreaker in some usecases.
Is there a way to see how much host interop a library with it's dependencies has?
Main motivation would be a rough estimate of how much work it would take to port to clojure/script/dart/clojurl/jank-lang etc.
That feels like something you might be able to do with #clj-kondo analysis
Hi @alexmiller, I think the word iff
is incorrect, do you mind checking?https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L191
that is its intent here
Could you use gen/fmap
to perform type conversion?
size-bounded-bigint
generator seems to have this option, i just don’t know the syntax for it
https://github.com/clojure/test.check/blob/master/src/test/clojure/clojure/test/check/test.cljc#L918 is this an example/