Fork me on GitHub

The optimization I made with CLJS-2894 inadvertently broke Dirac and I captured a ticket in Dirac for now


@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

@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


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


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


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?


@darwin I was testing 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.)


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.


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.


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


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


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.


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.)


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

👍 4

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


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


In Clojure you need to

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


ok, will update the code, thanks


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


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


cool, thanks 🙂


Some work towards inferring parameter types: Not quite Hindley–Milner, but it feels like a step towards it. 🙂

👏 16

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


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


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


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.


Seems like a really good idea


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


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


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


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


@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.


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


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