Clojurians
#cljs-dev
<
2017-12-14
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

dnolen16:12:09

now that .clojure is a thing I think it’s time we started caching compiled namespaces and analysis from JARs there

dnolen16:12:26

would be a big perf boost

dnolen16:12:54

~/.clojure/cljs/my/ns/compiler-version/foo.(js|...)

dnolen16:12:34

or something like that

mfikes16:12:44

Maybe somehow also incorporate the JAR version

dnolen16:12:28

or we could SHA the compiler version + JAR name?

mfikes16:12:29

Is that implied by the timestamps on the files?

dnolen16:12:14

we would only do this for JAR deps

mfikes16:12:20

In other words, I think today, cached analysis files that came from JARs are given the JAR timestamp. (Fuzzy memory.)

alexmiller17:12:42

You should pay attention to the logic in the clojure script to find the cache dir

alexmiller17:12:21

It is not always under .clojure

alexmiller17:12:55

And .clojure is not even the config dir necessarily

mfikes17:12:17

If somehow all of the information on this line

// Compiled by ClojureScript 1.9.968 {:static-fns true}
were used when forming the path (more than just compiler-version), then the cache would be useable across different projects that have different build-affecting options.

martinklepsch17:12:09

Also consider that jar contents may change while the name stays the same, so probably we should SHA the entire jarfile?

dnolen17:12:33

@martinklepsch most JARs have the version name no?

mfikes17:12:58

Probably want to deal with -SNAPSHOT JARs

martinklepsch17:12:19

-SNAPSHOT but also just people re-installing a jar of a dependency they manage

dnolen17:12:34

caching is based on timestamp of original source anyway

dnolen17:12:10

@mfikes that’s a good point - instead of compiler version we could just SHA that line?

dnolen17:12:26

then we could cache optimized versions and dev versions both

dnolen17:12:52

@alexmiller ah, we could also just use ~/.cljs

martinklepsch17:12:46

or something in /tmp/ — gets wiped on restart but who restarts their computers anyways ¯\(ツ)

martinklepsch17:12:14

this sounds very exciting though! :slightly_smiling_face:

dnolen17:12:35

for this kind of cache don’t want to put in temp

mfikes17:12:01

This seems like it would solve the problems that would arise if you attempted to include AOT artifacts in JARs themselves (mismatch with the compiler the end-user is using), while having effectively the same benefit.

dnolen17:12:55

will probably work a bit on this tomorrow - I think this is going to be a simple change but impactful

dominicm19:12:29

fwiw, on linux, the canonical directory for caching per-user is recommended as "$XDG_CACHE_HOME" with "~/.cache" as fallback.

richiardiandrea20:12:11

Agree with the above pretty please let's keep the conventions going :wink:

richiardiandrea20:12:34

This also opens up the question about how to include analysis cache from dependencies (I know it is a separate concern, just wanted to throw it there because it's already come up in the lumo world)

dnolen21:12:07

@richiardiandrea we would write those to the same place we write the compiled JS