clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
dominicm 2019-06-09T10:21:37.063700Z

Given that core.async takes ~4s to require, is it worthwhile providing a aot'd version of that dependency for the purposes of speeding up programs relying on it? Any downsides to that? Yada uses core.async, and it's making yada look very slow as this is one of the biggest causes of slowdown. @alexmiller I think you mentioned you were working on a potential caching utility for an upcoming clojure, would the need for this be obsoleted by your work?

borkdude 2019-06-09T12:18:38.064400Z

@dominicm maybe you can lazily require core.async, or is core.async also used by manifold and a non-optional thing in yada?

dominicm 2019-06-09T12:20:01.066200Z

Manifold uses core async too, and I don't think yada can be lazy because it's protocol extension (although maybe it could try and extend it only when required? Sounds potentially dodgy)

dominicm 2019-06-09T12:20:43.066300Z

having gone deeper now, it looks like it's the core.async.impl.ioc-macro's dependency of tools.analyzer which is slow.

alexmiller 2019-06-09T12:57:04.071800Z

Providing only an aot core.async is a recipe for trouble. You really need to aot all dependent code as well to avoid the classic protocol reloading issues. So would also need tools.analyzer etc. it’s really best to aot at the app level where you can do everything (and where you’re not deploying to maven and making that choice for everyone else)

alexmiller 2019-06-09T12:59:22.074200Z

And yes, I would expect the caching work would help. Really any time you’re reading and compiling something into a class that you’ve done before, it would potentially help

👍 1
borkdude 2019-06-09T20:30:16.075400Z

user=> (defrecord ^:private Foo [a])
user.Foo
user=> (meta #'->Foo)
{:arglists ([a]), :doc "Positional factory function for class user.Foo.", :line 1, :column 1, :file "NO_SOURCE_PATH", :name ->Foo, :ns #object[clojure.lang.Namespace 0x64b70919 "user"]}

alexmiller 2019-06-09T21:06:59.076Z

Private records are not a thing

2019-06-09T21:09:55.076500Z

but I'd wager you could alter-meta! the factory functions to be private

alexmiller 2019-06-09T21:10:43.077400Z

You can, or ns-unmap to remove entirely (which we do in a couple places)

2019-06-09T21:11:12.077700Z

I guess at the end of the file, if you want the references therein to compile

dominicm 2019-06-09T21:12:03.078300Z

Any reason they're not a thing?

2019-06-09T21:21:29.080900Z

@dominicm seems like that’d be confusing. Can’t have a “private top level” java class. So would have to be like package private. Which clj doesn’t really utilize. Only the auto generated factory functions would make any sense, and that seems odd to me.

borkdude 2019-06-09T22:04:03.081200Z

just for the record, CLJS:

ClojureScript 1.10.520
cljs.user=> (defrecord ^:private Foo [a])
cljs.user/Foo
cljs.user=> (meta #'->Foo)
{:private true, :ns cljs.user, :name ->Foo, :file nil, :end-column 25, :column 1, :internal-ctor true, :factory :positional, :line 1, :end-line 1, :arglists ([a]), :doc "Positional factory function for cljs.user/Foo.", :test nil}

borkdude 2019-06-09T22:04:12.081500Z

this is used in CLJS source code

borkdude 2019-06-09T22:14:17.082500Z

that seems to be a translation of this: https://github.com/clojure/clojure/blob/4ef4b1ed7a2e8bb0aaaacfb0942729252c2c3091/src/clj/clojure/pprint/pretty_writer.clj#L71 and maybe defstructs can be private in clojure