bhauman / figwheel-main

Figwheel Main provides tooling for developing ClojureScript applications
https://figwheel.org
Eclipse Public License 1.0
640 stars 93 forks source link

Slow to detect file changes #298

Closed timothypratley closed 2 years ago

timothypratley commented 3 years ago

Figwheel uses the Hawk library to watch files. There are now much faster options.

On MacOS Hawk takes about 6 seconds longer to detect file changes! This is a significant tax on reload speeds as compilation will not start until the change is detected.

I'll submit a PR to replace Hawk with Beholder

(ns compare
  (:require [hawk.core :as hawk]
            [nextjournal.beholder :as beholder]))

(defn start! []
  (hawk/watch! [{:paths ["src"]
                 :handler (fn [ctx e]
                            (println (System/currentTimeMillis) "HAWK event: " e)
                            ctx)}])
  (beholder/watch (fn [m]
                    (println (System/currentTimeMillis) "BEHOLDER" m)) "src"))

RESULTS:

1625110574151 BEHOLDER {:type :modify, :path #object[sun.nio.fs.UnixPath 0x569f0abb /Users/timpratley/git/beholder-test/src/compare.clj]}
1625110583837 HAWK event:  {:file #object[java.io.File 0x711d7500 /Users/timpratley/git/beholder-test/src/compare.clj], :kind :modify}
1625110583839 HAWK event:  {:file #object[java.io.File 0x57c70d1c /Users/timpratley/git/beholder-test/src], :kind :modify}
1625110586260 BEHOLDER {:type :modify, :path #object[sun.nio.fs.UnixPath 0x52a094b0 /Users/timpratley/git/beholder-test/src/compare.clj]}
1625110593839 HAWK event:  {:file #object[java.io.File 0x5900f994 /Users/timpratley/git/beholder-test/src/compare.clj], :kind :modify}
1625110593840 HAWK event:  {:file #object[java.io.File 0x601ee6f9 /Users/timpratley/git/beholder-test/src], :kind :modify}
1625110606770 BEHOLDER {:type :modify, :path #object[sun.nio.fs.UnixPath 0x17a20080 /Users/timpratley/git/beholder-test/src/compare.clj]}
1625110613846 HAWK event:  {:file #object[java.io.File 0x3eb87797 /Users/timpratley/git/beholder-test/src/compare.clj], :kind :modify}
1625110613846 HAWK event:  {:file #object[java.io.File 0x5d3f666c /Users/timpratley/git/beholder-test/src], :kind :modify}
timothypratley commented 2 years ago

This was addressed