This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (2)
- # beginners (82)
- # calva (13)
- # cider (12)
- # clara (4)
- # cljdoc (22)
- # clojure (89)
- # clojure-dev (23)
- # clojure-europe (16)
- # clojure-italy (39)
- # clojure-nl (8)
- # clojure-spec (28)
- # clojure-uk (36)
- # clojurescript (40)
- # cursive (10)
- # data-science (1)
- # datomic (27)
- # devcards (4)
- # emacs (1)
- # fulcro (25)
- # jobs (1)
- # jobs-discuss (3)
- # kaocha (5)
- # luminus (1)
- # nrepl (68)
- # off-topic (64)
- # pedestal (23)
- # planck (1)
- # quil (4)
- # re-frame (6)
- # reitit (5)
- # remote-jobs (4)
- # shadow-cljs (16)
- # spacemacs (11)
- # testing (1)
I'm finally getting productive with clojure, but now I'm finding out that sizable (read: useful) projects take forever to load a repl (I use cider/emacs)... we're talking a couple minutes per bounce... what am I doing wrong?
if you're using user.clj and a very recent JDK version, you might have stumbled into a Java performance regression
see https://dev.clojure.org/jira/browse/CLJ-2484 - we are testing a workaround in 1.10.1-beta2
you could try downgrading your java version or upgrading Clojure to 1.10.1-beta2 to see if that helps
@macrobartfast As a sanity check, I just timed my REPL startup time -- via
clj with a profile that contains every single dependency our 80,000+ line Clojure project uses, which also starts a Socket REPL and starts up Cognitect's REBL tool. A cold start to a live REPL with REBL open takes just under 12 seconds on my Mac.
Per Alex, it could be the JVM regression if you're on either of those versions...
java version "1.8.0_92" Java(TM) SE Runtime Environment (build 1.8.0_92-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
(without REBL and the Socket REPL, starting a plain REPL takes about 8 seconds for comparison)
OK, so on that version of Java/JVM it's unlikely to be the regression Alex mentioned.
Maybe ask in #cider and/or #emacs and see if they can suggest ways to optimize startup?
Also, I'm starting a REPL into the
user namespace which means it doesn't need to load my main namespace.
6.6 vs your 11.
(! 780)-> lein new app timing Generating a project called timing based on the 'app' template. (! 781)-> cd timing (! 782)-> time lein repl < /dev/null nREPL server started on port 57337 on host 127.0.0.1 ... timing.core=> Bye for now! real 0m7.290s user 0m5.564s sys 0m0.490s (! 783)-> time lein repl < /dev/null nREPL server started on port 57351 on host 127.0.0.1 ... timing.core=> Bye for now! real 0m6.634s user 0m5.467s sys 0m0.486s (! 784)->
Leiningen adds a lot of overhead, compared to the CLI/`deps.edn` stuff, just FYI:
6.6 goes down to 1.4 🙂
(! 787)-> clj -A:new app timing.core Generating a project called timing.core based on the 'app' template. (! 788)-> cd timing.core/ (! 789)-> time clj < /dev/null Clojure 1.10.1-beta2 user=> real 0m4.462s user 0m11.724s sys 0m0.563s (! 790)-> time clj < /dev/null Clojure 1.10.1-beta2 user=> real 0m1.385s user 0m2.742s sys 0m0.194s (! 791)->
We love it. We switched from Boot to CLI last year (after switching from Leiningen to Boot just over three years ago).
I usually just lein repl at the root of the project... how would I specify a namespace?
It depends what's in your
project.clj -- when the REPL starts, is it in
user or some project-specific ns?
I've also found (and it was a long time ago) that luminus-based projects have quite a long startup time; and it was a very simple service actually. It's perhaps because of many depedencies it introduces...
probably is something to do with cider/emacs and all that, per what you were saying.
the luminus setup usually has a user.clj file and loads (and compiles) a large set of your project and dependent files on startup. I would look more carefully and see if you're doing something at the top level somewhere in addition to that too.
Any way to spec something as a list or a cons? Is there a pred for that? Basically, I want a pred for clojure code
generally, I find it's best to spec inputs to macros using the regex ops
Thanks, I'll have a look at it again. I guess I'm not sure why I ever tried to restrict it in the first place.
fn is technically a "special form" but it is implemented as a macro that calls
fn* which is part of the compiler
let is a special form too, but it is also implemented as a macro that uses
I am writing some cljc code and realizing that there must be something about JVM-clojure and namespaced type hints that I don’t understand. If I have a type/record, I seem to be able to use its name as a type hint within its own namespace, but not from another namespace? example: https://gist.github.com/mhuebert/3269ac0b5bebebb93de9c497a33a694f
you don't necessarily need to import it, you simply need to refer to it as a class rather than as a Var
it needs to be
n.T (namespace aliases are not valid either,`n` must be fully qualified)
yes -- import would just allow shorter naming,
MyType (closer to
t/MyType from the example)
and then I suppose I would refer
MyType in the cljs version, so that a plain
^MyType annotation works for both
does subvec allows for garbage collecting of unused nodes say if we want [1 2 3] -> [2 3] what is my options aside from vec -> seq -> vec
ideally, don't use a vector in the first place if you need to remove elements any place but the end
subvec will keep the original vector in memory so will not be gc'ed
How do i create a var in a another namespace? I know that it is not common, but I'm doing a DSL that "compiles" to #clara, and clara use vars in namespaces...
Hey all, we’ve written a post on the Amperity Eng blog on Greenlight (our Clojure integration testing library). https://eng.amperity.com/posts/2019/04/greenlight
Oh wow that is seriously cool. I’ve seen the project before but never got the value proposition. Are you aware of https://github.com/caioaao/kaocha-greenlight ? I’m using kaocha for running other tests.
Hey @U7PBP4UVA thanks we have seen that. I think the answer to your question is yes they should work. Feel free to file an issue if you find out this isn’t the case
@U5JFWFE2V Looks good! Am I right to observe that the step idea has some overlap with ideas from Cucumber? Or is that just accidental?
this code runs when i 'lein run' it but some jars fail their static initializers that try to classload XML expecting to get the system classloader (AFAIK)
user.clj is loaded pretty early in the RT - you could try adding one that sets