boot-clj / boot-clj/boot

Boot slow to recognize file changes on Mac OS X

Open
#299 6 comments 0 reactions 0 assignees View on GitHub
Bug macOS question
Dominant language
Clojure
Stars
1.7k
Forks
178
PR merge metrics
No merged PRs in 30d

Description

I am having a problem with incredibly slow incremental build times (e.g. ~10s). I have over 2k files that are in my `:asset-paths`. These files are CSS and js libraries that I am using for cljs dev. The majority of these files are stored in a directory called `bower_components`. If I remove `bower_components` from my `:asset-paths` the compile time goes down to ~1-2s. This same project will compile in ~1s on my Linux machine. Here is a [screen recording](https://youtu.be/POezSRNnQgI) of how long it takes.

I have been discussing this problem on the boot slack channel. Here are some things that we have tried without success:
- Increase boot RAM
- Attempt to add js/css libraries with [webjars](http://www.webjars.org/) through this [task
](https://gist.github.com/exload/c83e1f50da344f3f8735)

I have tried enabling `:compiler-options {:compiler-stats true}` and I get this output. As you can see the majority of the time taken is not from compiling or adding dependencies, it actually comes from recognizing the file change.

```
Writing main.cljs.edn...
Compiling main.js...
Compile basic sources, elapsed time: 12.82221 msecs
Add dependencies, elapsed time: 868.525619 msecs
Elapsed time: 10.494 sec
```

My temporary workaround is to use a copy task to copy the build files out or `target/` to a new folder. This will get the incremental build time down to 2.7s. Here is my new boot task:

``` clojure
(deftask web-dev
"Developer workflow for web-component UX."
[]
(comp
(asset-paths :asset-paths #{"html" #_"bower_components"})
(serve :dir "public/")
(watch)
(speak)
(reload)
(sass :sass-file "main.scss"
:output-dir "styles"
:line-numbers true
:source-maps true)
(cljs :compiler-options {:compiler-stats true})
(copy)))
```

With the task option using a forked [boot-copy](https://github.com/Provisdom/boot-copy):

``` clojure
copy {:output-dir "./public"
:matching #{#".*\.html"
#".*\.js"
#".*\.map"
#".*\.css"}
:ignore #{#"^(out|\/out)\/.*"}}
```

My build.boot file: https://gist.github.com/exload/b063fb9e827a5eb3b21c

System Specs (Brand new top of the line MBP):
- OS X Yosemite 10.10.5
- 2.8 GHz Intel Core i7
- 16 GB 1600 MHz DDR3
- AMD Radeon R9 M370X 2GB
- Encrypted SSD (possibly important as this could slow down file change notifications)

Output from `boot -V`

```
BOOT_CLOJURE_VERSION=1.7.0
BOOT_VERSION=2.2.0
#App version: 2.2.0
```

Output from `$BOOT_JVM_OPTIONS`

```
-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx2g -XX:MaxPermSize=128m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Xverify:none
```

Output from `java -version`

```
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.