This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-31
Channels
- # architecture (1)
- # aws (23)
- # beginners (13)
- # boot (18)
- # cider (5)
- # clara (1)
- # cljs-dev (22)
- # cljsjs (9)
- # cljsrn (28)
- # clojure (120)
- # clojure-canada (12)
- # clojure-dev (6)
- # clojure-italy (4)
- # clojure-korea (1)
- # clojure-russia (18)
- # clojure-sg (8)
- # clojure-spec (45)
- # clojure-uk (12)
- # clojurescript (240)
- # component (4)
- # cursive (17)
- # datomic (91)
- # editors-rus (4)
- # figwheel (2)
- # flambo (6)
- # hoplon (163)
- # instaparse (6)
- # jobs (1)
- # leiningen (2)
- # luminus (5)
- # om (22)
- # om-next (2)
- # onyx (35)
- # perun (15)
- # play-clj (1)
- # protorepl (4)
- # re-frame (106)
- # reagent (4)
- # ring (106)
- # schema (1)
- # spacemacs (17)
- # untangled (40)
- # yada (14)
hey, so i have kind of a dumb question
i’m using boot watch to reload files
but it only really works for cljs
is that expected, that the clj side of things won’t reload on watch?
so usually it's up to the user to specify how and when you want to get the backend code reloaded
well i think recompiling would be ok
atm i change a function and nothing at all happens
i can’t even stick in a prn
to debug without waiting for a 70s+ boot command 😕
@dm3 i think i’m missing something very basic 😉
hmm, but it’s a web server
after changing something that is not recompileable, e.g. types that are part of a running application state
which computes the namespace dependency graph and reloads all of the namespaces where the dependencies got modified
i’ve been following the instructions at https://github.com/boot-clj/boot/wiki/Repl-reloading
for the repl
does that work with the code the web server would be using too?
i’ve just been pasting (repl/refresh)
into the repl as needed so far
been using https://github.com/pandeiro/boot-http for serving stuff
i suppose i’m confused because my boot task is like (comp (watch) (serve …))
so i had thought the watch would “re-serve"
but it doesn’t work that way
wait, i have an idea, lol
no, i don’t think that worked
@dm3 i think i figured it out
and i think it was very basic
the serve
task has a :reload true
option
yup, i wasted a loooot of time not having that turned on 😕
ok, next dumb q
when i do this
time env BOOT_JVM_OPTIONS="-client -Xmx2g -Xverify:none -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled" boot -h
i see a speedup for boot
but when i put BOOT_JVM_OPTIONS="-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx2g -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Xverify:none”
into boot.properties
nothing happens
well the file worked for other things, like BOOT_EMIT_TARGET
https://github.com/boot-clj/boot/wiki/Configuring-Boot#note-about-boot_jvm_options
also, is it normal that compiling cljs without any optimisations takes ~30 seconds?
it’s from the point boot says Compiling ClojureScript…
the whole thing from boot dev
to something i can load in the browser is more like 70s
i’ve got maybe 1700 LOC in cljs
+ some libs
@thedavidmeister yes, 30-70s is possible if it's a clojurescript project how fast can this project start for you (after the deps has already been downloaded)? https://github.com/addplus/hoplon-ui-reload-example
i’ll check
i just get errors for that repo @onetom
the text is very long
ah, sorry, i forgot hoplon-ui is not in clojars yet. here is a similar repo which is good for benchmarking: https://github.com/onetom/boot-reloadable-hoplon
ok, 22 seconds
20-30s
pair@dusty ~/g/o/boot-reloadable-hoplon> time boot dev
Starting reload server on
Writing adzerk/boot_reload/init3346.cljs to connect to ...
Starting file watcher (CTRL-C to quit)...
Writing HTML files...
• index.html
Adding :require adzerk.boot-reload.init3346 to index.html.cljs.edn...
Compiling ClojureScript...
• index.html.js
Starting Vert.x on port 8000...
Elapsed time: 19.989 sec
^C
Stopping Vert.x on port 8000...
32.18 real 73.49 user 3.40 sys
titdm:boot-reloadable-hoplon thedavidmeister$ time boot dev
Starting reload server on
Writing adzerk/boot_reload/init3306.cljs to connect to ...
Starting file watcher (CTRL-C to quit)...
Writing HTML files...
• index.html
Adding :require adzerk.boot-reload.init3306 to index.html.cljs.edn...
Compiling ClojureScript...
• index.html.js
Starting Vert.x on port 8000...
^C
Stopping Vert.x on port 8000...
real 0m26.508s
user 1m34.580s
sys 0m3.406s
Processor Name: Intel Core i5 Processor Speed: 2.7 GHz Number of Processors: 1 Total Number of Cores: 4 L2 Cache (per Core): 256 KB L3 Cache: 6 MB Memory: 16 GB
yeah i turned that on
but i still get this 😞
Starting reload server on
Writing boot_reload.cljs...
Starting file watcher (CTRL-C to quit)...
Started HTTP Kit on
Compiling Hoplon pages...
• index.cljs.hl
Adding :require adzerk.boot-reload to index.html.cljs.edn...
Compiling ClojureScript...
• index.html.js
Writing target dir(s)...
Elapsed time: 59.284 sec
^C
real 1m23.689s
user 1m49.179s
sys 0m5.921s
also notice that you are starting both the frontend and the backend probably, so you load (and compile) a lot more libraries
shaved about 10s
Starting file watcher (CTRL-C to quit)...
Started HTTP Kit on
Compiling Hoplon pages...
• index.cljs.hl
Compiling ClojureScript...
• index.html.js
Elapsed time: 54.853 sec
^C
real 1m14.745s
user 1m43.203s
sys 0m5.179s
also yeah, ssd 🙂
this is how i’m doing cljs
(cljs :optimizations :none
:compiler-options { :parallel-build true
:cache-analysis true})))
well i think it will happen to me less now actually
now that i found that :reload true
option to get the backend to reload
Also if I use all those advance startup time saving options, I actually get the following:
pair@dusty ~/g/o/boot-reloadable-hoplon> time env BOOT_JVM_OPTIONS="-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx2g -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Xverify:none" boot dev
Starting reload server on
Writing adzerk/boot_reload/init3346.cljs to connect to ...
Starting file watcher (CTRL-C to quit)...
Writing HTML files...
• index.html
Adding :require adzerk.boot-reload.init3346 to index.html.cljs.edn...
Compiling ClojureScript...
• index.html.js
Starting Vert.x on port 8000...
Elapsed time: 13.981 sec
^C
Stopping Vert.x on port 8000...
20.23 real 28.71 user 1.70 sys
i only use this though:
pair@dusty ~/g/o/boot-reloadable-hoplon> echo $BOOT_JVM_OPTIONS
-Xmx2g -Xverify:none
yeah i have all the things turned on
because the incremental compile can get optimized over time and gives us around 1second re-compile times
if i have those startup time optimizations, my incremental compile time doesn't go below 1.5-1.8s
my incremental compile is like 3-4s
yes, my cljs is really slow
any other things i can tweak?
you should try this vertx based server too, using the boot-static
package, but that would assume you have your backend served separately
also you pressed Ctrl-C too early in your example. you should wait until the Elapsed time: ... appears
ah i see, so you can have one boot task to fire up the backend and one to handle cljs?
also with 8GB ram i can imagine that you might max that out and your cljs compilation process is forced to do swapping...
@thedavidmeister exactly
Processor Name: Intel Core i7
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core): 256 KB
L3 Cache: 6 MB
Memory: 8 GB
pair@dusty ~/a/be> time boot dev
nREPL server started on port 63750 on host 127.0.0.1 -
Starting file watcher (CTRL-C to quit)...
Starting #'sys/dev
Elapsed time: 1.604 sec
^C 17.02 real 43.73 user 1.53 sys
and my recompile + reload times are like this:
#'sys/dev:refreshing
Unloading: (app.profile-test app.users-test app.core-test app.schema-test sys app.schema app.core app.users)
Reloading: (app.users app.core app.schema sys app.schema-test app.core-test app.users-test app.profile-test)
Elapsed time: 0.689 sec
which is actually slow because those *-test
namespaces shouldn't even be reloaded really i think...
hmm ok
would that be ok if i use sente?
aight, i guess i’ll put some more tickets up
thanks for the help
anything to get these load times down is useful
it is getting to the point where it’s getting in the way
so i don't know what the pitfalls would be.
in case of using castra, i had to specifically use [jumblerg/ring.middleware.cors "1.0.1"]
for the CORS support
also that backend reloading is implemented by the stuart sierra REPL flow which im using via danielsz/boot-system
the problem i found with panderios/boot-http
is the it's just using the jetty server built-in reload functionality, which is only triggered during serving a request
that is annoying
so its always one behind?
so i switched to
<dependency>
<groupId>tailrecursion</groupId>
<artifactId>boot-jetty</artifactId>
<version>0.1.3</version>
<scope>compile</scope>
</dependency>
for a long time agoyes, it was always behind. it might have been an old bug but at that time it seemed like an architectural issue of boot-http
well until tonight i’ve had to re-run boot dev
for every change
and wait a 1:20
so even being one behind is an upgrade >.<
well even saving 10s here and there helps my sanity
but then again, i don't have a better recommendation than using boot-system
which would require a serious rehaul of the app
using https://github.com/tolitius/mount might be better but im yet to figure out how can it form a coherent flow with intellij....
also my recommendation is to get the fastest possible machine you can possibly purchase with at least 16GB ram
i’m just using atom
i’m not actually making any money off my app yet, so...
if i get some customers one day i will 🙂
oh, i literally just moved house
and have a huge backlog of shit to buy for the apartment
haha, somewhere on the list
i’m going to start with “kitchen table"
and “bed"
before “another 8gb of ram"
lol, my gf is getting an upgrade before me
can you imagine, she’s trying to compile this stuff on an air
it just doesn’t really happen
see you can get a kitchen table with 1GB ram first, so you get another 8GB into your computer instead and only then upgrade your kitchen table 😉
well we had an imac at the last place, that was ok
but there’s just nowhere to put it here
we’ll get there
anyway, i g2g
getting late here
thanks again for the help