This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-23
Channels
- # announcements (3)
- # asami (5)
- # babashka (1)
- # beginners (38)
- # biff (4)
- # calva (12)
- # cider (2)
- # clj-commons (6)
- # clj-kondo (46)
- # clj-on-windows (1)
- # clojure (50)
- # clojure-europe (41)
- # clojure-nl (3)
- # clojure-norway (2)
- # clojure-uk (16)
- # clojured (3)
- # clojurescript (49)
- # conjure (1)
- # cursive (29)
- # datahike (6)
- # datascript (4)
- # emacs (70)
- # funcool (1)
- # google-cloud (12)
- # graalvm (10)
- # graalvm-mobile (7)
- # gratitude (4)
- # hyperfiddle (1)
- # joyride (26)
- # lsp (16)
- # malli (23)
- # nbb (5)
- # off-topic (23)
- # polylith (32)
- # re-frame (23)
- # releases (3)
- # remote-jobs (1)
- # reveal (3)
- # tools-build (16)
- # xtdb (50)
Hi! I’m hitting a performance bottleneck when AOT-compiling my large project with clojure.tools.build.tasks.compile-clj/compile-clj
. I narrowed the problem down to clojure.tools.build.util.file/copy-contents,
it spends about 5 minutes copying my roughly 35k class files from working directory to target/classes
. I suspected some other service might be keeping my M1 Macbook busy, but nothing found so far. Does this sound familiar to anyone? Is the problem as simple as just having way too many class files?
Do you have any company-prescribed security software scanning your file system? I've had some pretty drastic improvements disabling said software when building / compiling
Like 5m -> 30s or so
@U0NCTKEV8 Oh, maybe I misinterpreted the meaning of this part then https://github.com/clojure/tools.build/blob/master/src/main/clojure/clojure/tools/build/tasks/compile_clj.clj#L109. I ran that in a modified version, just logged the time before and after it.
@U02EA2T7FEH Could be, I should probably look into that.
@U09R86PA4 That is also an excellent question. I’m using one that was installed by company scripts, it is JDK 17 and it says “Apple” under “Type” in activity monitor, which should indicate it’s m1-native?
it compiles into a tmp dir, then copies back, but could potentially do otherwise. if you want to file a question on https://ask.clojure.org that would help get it into the queue for me to look at
Related to that, depstar
1.x used to work exactly as tools.build
does right now, but depstar
2.x switched to building the JAR directly from the tmp dir to avoid that extra copy step and it made a big difference to uberjar build times when AOT was used. The separation of compile & copy means you have a cleaner target
folder if compilation fails -- it isn't populated with a mix of old and new classes (assuming you didn't clean
it beforehand) or even a partial set of new classes.
(we've switched to building our uberjars in CI only so we don't care about the additional time -- and CI is much faster than our dev machines anyway)
@U04V70XH6 We recently chose the approach of cleaning the target
folder before every startup, to avoid some issues we saw with hot reloading and stale/duplicate class files. So we are fine with compiling directly to target
.
@U064X3EF3 Thanks, I posted a question.
Thanks everyone! We ended up forking tools.build to compile directly to target/classes. And @U02EA2T7FEH was right, our problem seems to have been caused by security software scanning file events.