Skip to content

Commit 70b00b3

Browse files
committed
smaller changes in dev startup guide
1 parent 1b84d9b commit 70b00b3

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

content/guides/dev_startup_time.adoc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ The `compile` function takes a namespace symbol and compiles that namespace and
2424

2525
Subsequently, when any of those compiled namespaces are required, the class file will be loaded, rather than the original `.clj` file. If a source file is updated (and thus newer), it will be loaded instead. Periodically, you will need to re-compile to account for new dependencies or changing code.
2626

27-
NOTE: Compilation happens as a side-effect of loading a namespace, and thus has no effect on already required ones. Use `*compile-files*` with `:reload-all` as suggested below to compile already loaded namespaces.
28-
29-
One special case is the `user.clj` file loaded automatically by the Clojure runtime, before any other code is loaded. (Though this applies equally to compiling any namespace that has already been loaded into the REPL.) If you are using a `user.clj` in dev, you need to force a reload because it has already been loaded automatically:
27+
Note that compilation is a side effect of loading, so has no effect on already loaded namespaces. In particular, one special case is the `user.clj` file, which is loaded automatically by the Clojure runtime. If you are using a `user.clj` in dev (or need to compile namespaces that are already compiled), you can do so by forcing a reload while compiling:
3028

3129
[source,clojure]
3230
----
33-
(binding [*compile-files* true] ; <1>
34-
(require 'user :reload-all)) ; <2>
31+
(binding [*compile-files* true] ;; compile during load
32+
(require 'user :reload-all)) ;; reload this and all transitively loaded namespaces
3533
----
36-
<1> Tell Clojure to compile any namespace it is loading
37-
<2> Tell Clojure to reload this and all required namespaces
3834

3935
That's it! This technique can substantially reduce your startup time during development, particularly as the number of dependencies you load increases.
4036

0 commit comments

Comments
 (0)