Fork me on GitHub
#cljs-dev
<
2019-02-01
>
bronsa14:02:46

In addition to core predicates, predicte-induced typo

bronsa14:02:37

I'm curious to see how the loop/recur inference works, clojure does it but it requires some quadratic number of passes in the worse case

bronsa14:02:46

can anybody point me to where it's done?

bronsa14:02:58

the predicate inference stuff looks sick, I wanted to play with it in CinC too but never got round to it, congrats to everybody involved to getting it done

dnolen14:02:04

@bronsa it's probably different since we just loosen the inferred type

dnolen14:02:40

we don't really care about the primitive stuff that Clojure does

bronsa14:02:41

ah I see, yeah in clojure it's pretty involved as it completely changes the type inference in interop call s

dnolen14:02:58

right we don't need type inference for that

bronsa14:02:17

what happens in clojure is that the entire loop body needs to be re-analyzed if a recur point invalidates the inferred type from the loop point

bronsa14:02:26

which is what makes the process O(scary)

dnolen14:02:30

don't need to do that

dnolen14:02:35

types are represented as a set

dnolen14:02:40

so we just add whatever else we see

bronsa14:02:15

thanks for the info

mfikes14:02:33

@bronsa I’d have to re-look at the implementation again, but re-analysis is part of the game. IIRC, it is limited to one re-analysis pass. To address the compiler-perf concern we did some testing…

bronsa14:02:31

does that mean double macroexpansion?

mfikes14:02:25

Here is the ticket: https://dev.clojure.org/jira/browse/CLJS-2873 Empirically the effect in that test was a speedup of 0.97 when compiling a test corpus of code.

mfikes14:02:00

Good question about the macroexpansion :thinking_face:

bronsa14:02:38

clojure does macroexpand multiple times

bronsa14:02:07

in my tools.analyzer impl I implemented that pass by invalidating the type inference pass in the AST and re-running the pass rather than re-analyzing and re-macroexpanding the loop body

bronsa14:02:12

but it makes it a bit more complex

bronsa14:02:50

I'll take a look at that patch, thanks

mfikes14:02:21

More on the overall perf tests cited in that ticket are at https://github.com/mfikes/cljs-perf/

bronsa14:02:16

those look like some really nice incremental improvements, congrats :)

borkdude23:02:35

Just found out that you do need to require [clojure.test.check.properties] separately from [clojure.test.check] before using (stest/check), so I think going back to the old error message is better, which means reverting: https://github.com/clojure/clojurescript/commit/90c9a680e3e269a0b5f40cc907d9889d03c8dcbb

borkdude23:02:31

Sorry for the inconvenience 😞

borkdude23:02:32

I can make a JIRA + PR to the site tomorrow

dnolen23:02:11

sure, thanks