Fork me on GitHub
#cljs-dev
<
2018-09-08
>
mfikes00:09:40

The optimization I made with CLJS-2894 inadvertently broke Dirac and I captured a ticket in Dirac for now https://github.com/binaryage/dirac/issues/81

darwin13:09:20

@mfikes thanks, I will roll a new dirac release later today which will include a future-proof fix. To prevent this from happening in the future, we could introduce a public function in cljs.repl which would reset source map bindings to start values, I would simply call that function instead of dealing with implementation details of individual bindings…

👍 4
mfikes13:09:43

@darwin This version of the compiler hasn’t yet been released, so there may not be any need to rush with a release or change in Dirac

darwin13:09:12

thanks, I’m aware, but I want to refresh it anyway - to bump chrome devtools codebase to latest

mfikes13:09:47

Cool. I suppose your change is robust in that it checks using ns-resolve

darwin13:09:23

yes, I tested it with both versions of cljs.repl code, btw. how did you find that Dirac broke? you did a github search for that bindings code?

mfikes13:09:51

@darwin I was testing https://dev.clojure.org/jira/browse/CLJS-2895 with Dirac. (TL;DR on CJS-2895 is that, if we can reduce the volume of source map information emitted, we can improve compiler perf, but it is not clear yet which source map entries we can remove, and I was simply trying to learn empirically by driving Dirac with some hypothetical changes—in fact, you might have some insight on the subject given your familiarity with how Dirac works.)

mfikes13:09:17

I got it down to just emitting source maps for ASTs with these ops:

#{:var :local :js-var :js :binding}
but to be honest that conclusion is only based on light testing with Dirac’s breakpoint example.

mfikes13:09:38

I found, for example, that if you omit :binding, Dirac can no longer show let-bound locals properly in its UI. So it is somewhat unfortunately an open-ended pursuit.

darwin13:09:52

Dirac does not directly work with source-maps, it just has to make sure, that repl js code snippets include proper source maps, I could look into devtools codebase what fields from source-maps they actually use, to confirm your assumptions

darwin13:09:01

also maybe some source-maps info is used by V8, which is much lower level (just speculating here)

mfikes13:09:07

Well, the problem is that there are really no fields, it is just a matter of whether a sufficient number of line/col mappings have been emitted in the right places for things to work.

mfikes13:09:12

So, it is really difficult to deduce logically which ones we need to keep. (Apart from perhaps arguing that, if you eliminate a tag for, say :throw it causes such-and-such thing to no longer be done, as an example.)

mfikes13:09:01

Right now it is conservative, and spits out a fantastic firehose of line/col information 🙂

👍 4
darwin13:09:02

an unrelated question: should (declare *something*) also include ^:dynamic when doing forward declaration of dynamic vars? I started seeing warnings related to that

mfikes13:09:26

Well, FWIW, ClojureScript master’s behavior matches Clojure’s for this case.

mfikes13:09:11

In Clojure you need to

(declare ^:dynamic *something*)
to avoid triggering the diagnostic

darwin13:09:47

ok, will update the code, thanks

mfikes13:09:52

(No new semantics were added to the compiler, it is just a new warning.)

mfikes13:09:19

By the way, Dirac is an awesome tool. I had never delved this deeply into it before. Very nice 🙂

darwin13:09:02

cool, thanks 🙂

mfikes19:09:52

Some work towards inferring parameter types: https://gist.github.com/mfikes/1e2341b48b882587500547f6ba19279d Not quite Hindley–Milner, but it feels like a step towards it. 🙂

👏 16
kommen20:09:33

> Showing 1 changed file with 65 additions and 20 deletions.

kommen20:09:16

I’m kind of blown away that a change like this is can be this small

john20:09:57

So, what would be helpful for the annotation/optimization efforts? Find host interop spots (like subs) that pass or receive primitives and annotate them?

mfikes20:09:14

Yeah, I would imagine if a change like this makes it into master then we may need to sprinkle some hints at the bottom to fully leverage it.

john20:09:23

Seems like a really good idea

petterik22:09:01

Would it be possible to retrieve a YourKit license to do some profiling of the compiler? Are there any prerequisites I must meet first?

Alex Miller (Clojure team)22:09:39

You can get free licenses of yourkit for oss work afaik

mfikes22:09:10

Yeah, we have one for ClojureScript. In the past, David had received some license keys from them.

petterik23:09:39

At #73 with 2 commits in the contributors list, maybe it's not reasonable to get one.

petterik23:09:08

I can probably get one from work instead :man-shrugging:

mfikes23:09:13

@petterik I suspect the way it works is that YourKit makes a certain number of licenses available to David and then he just hands them out. We can check with him when he’s back around.

mfikes23:09:38

I still have my ClojureScript YourKit license from 2015. I could use an upgrade 🙂

petterik23:09:27

ok, and yes you could! Your work on cljs is fantastic 👌