day8 / re-frame

A ClojureScript framework for building user interfaces, leveraging React
http://day8.github.io/re-frame/
MIT License
5.43k stars 715 forks source link

Re-frame is leaking metadata, perhaps? #365

Closed stoeckley closed 7 years ago

stoeckley commented 7 years ago

This does not happen with a vanila reagent build, but it does with reframe. I get lines like this in the compiled advanced compilation:

(ce,"/Users/andrew/projects/ajs/NONCPP/cljstest/reframe3/target/cljsbuild-compiler-1/cljs/core.cljc")

David Nolen via Slack suggested that this is a leak of meta data happening in re-frame, and that I should post an issue here.

This happens with a hello-world reframe build, no logic of my own added.

mike-thompson-day8 commented 7 years ago

Can you give more information on what you mean by "A hello-world re-frame build" ? Does that mean you used a template?

stoeckley commented 7 years ago

I'm using the re-frame lein template. I've narrowed down the problem. Observe:

~/projects/ajs/NONCPP/cljstest lein new re-frame metaleak
Generating re-frame project.
~/projects/ajs/NONCPP/cljstest cd metaleak/
~/projects/ajs/NONCPP/cljstest/metaleak lein cljsbuild once min
Compiling ClojureScript...
Compiling "resources/public/js/compiled/app.js" from ["src/cljs"]...
Successfully compiled "resources/public/js/compiled/app.js" in 14.405 seconds.

Then also:

~/projects/ajs/NONCPP/cljstest lein new re-frame metaleak2 +re-frisk
Generating re-frame project.
~/projects/ajs/NONCPP/cljstest cd metaleak2/
~/projects/ajs/NONCPP/cljstest/metaleak2 lein cljsbuild once min
Compiling ClojureScript...
Compiling "resources/public/js/compiled/app.js" from ["src/cljs"]...
Jul 14, 2017 3:23:09 PM com.google.javascript.jscomp.LoggerErrorManager println
WARNING: /Users/andrew/projects/ajs/NONCPP/cljstest/metaleak2/target/cljsbuild-compiler-1/cljs/compiler.js:559: WARNING - References to the global RegExp object prevents optimization of regular expressions.
cljs.compiler.emit_constant.cljs$core$IMultiFn$_add_method$arity$3(null,RegExp,(function (x){
                                                                        ^

Jul 14, 2017 3:23:09 PM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 0 error(s), 1 warning(s)
Successfully compiled "resources/public/js/compiled/app.js" in 193.626 seconds.

Note the huge difference in compilation time: wow!

But -- the metadata leakage does not happen in the first build, without re-frisk. It does appear in the second build (along with the odd compiler warning).

So perhaps I should move this issue to re-frisk?

stoeckley commented 7 years ago

closing this issue since it will be handled by the re-frisk repo