Fork me on GitHub
#clojurescript
<
2015-07-22
>
danielcompton05:07:15

I’m on a dual core laptop, would a quad core machine speed up ClojureScript compile times? i.e. does the ClojureScript compiler take advantage of multiple cores?

ordnungswidrig07:07:05

@danielcompton: not terribly sure but I guess not. I only see a single core max out to 100%

thheller10:07:36

@danielcompton: the compiler itself is not multi threaded, so only one core.

kahunamoore10:07:46

Rohit & Saurabh: Thanks for your help. Yes, I started with the descjop lein template. Knowing that Om brings in React I thought I wouldn’t have to do anything to pull it in but it didn’t work. Let me start over again with that template and walk my way through the problems I originally encountered… maybe something I did broke it. The odd thing is that I can see the React code in the generated cljsbuild-main.js, but still no joy. I’ll then push the project to GH so you can take a look… It will take me about 10 minutes...

rohit10:07:18

great @kahunamoore. i’ll have a look

rohit10:07:22

btw, have a look at this as well: https://github.com/oakmac/cuttle

rohit10:07:31

its a really well built electron/atom-shell app

rohit10:07:59

imho, its a better “template” than descjop

kahunamoore10:07:18

+1 will do, thanks!

kahunamoore11:07:28

@rohit Thanks for the link to cuttle. By reviewing it I noticed it has a separate app.js that is just hand coded js for loading the Electron main window. The cuttle index.html loads the main.js generated by http://cljsbuild.In the descjop template generates a cljsbuild that only has a single cljs core namespace that loads the Electron main window. This js

kahunamoore11:07:38

So I separated the Electron js logic from the cljs build. That was the missing piece, thanks again for pointing out cuttle. I’m going to study it further to learn more about how it integrates with Electron.

dnolen12:07:52

@danielcompton: does not there’s a ticket for parallel compile, no one’s taken it up yet simple_smile

rohit12:07:17

@kahunamoore: there are two js processes in electron: main process and the renderer process. you need a javascript file for each.

dnolen12:07:46

@danielcompton: we can probably improve compile times a bit working with some other folks on that. But in the end the slowest part cannot be improved - advanced compilation.

danielcompton12:07:06

@dnolen: do you mean that to speed things up we'd need to speed up the Closure compiler for advanced optimisations?

danielcompton12:07:25

Or at least that's where the biggest wins are?

dnolen12:07:38

@danielcompton: no I mean I don’t even know how you would make that faster.

dnolen12:07:58

but it doesn’t really seem all that important me

dnolen12:07:17

whole program analysis / optimization can’t possibly be cheap

dnolen12:07:42

@danielcompton: to clarify a bit more, I think we can make ClojureScript cold builds and incremental development build times much faster. Productions build time enhancements will come from people who work on Closure Compiler.

greywolve14:07:08

how do you check if a javascript variable (in the js ns) is undefined?

greywolve14:07:29

(when-not js/whatever ...) just blows up and trying the usual idiom in js typeof blah !== "undefined" is no good either

teslanick14:07:03

What if you try (when-not js/window.whatever) ?

greywolve14:07:51

thanks that works simple_smile

greywolve14:07:02

(aget js/window "var") aswell

dnolen14:07:50

@greywolve: aget for this is not idiomatic.

dnolen14:07:20

exists? was added for this specific reason, should work regardless of JS environment

dnolen14:07:44

@teslanick: @greywolve in both cases you will need externs unless it is some browser feature you are checking for.

greywolve15:07:25

@dnolen: thanks, wasn't aware of 'exists?'

estsauver15:07:30

I have a design question: I’m rendering a map as a tree using reagent. I want to be able to update keys using a textfield, but changes cause a rerender and focus loss. It looks like the problem is I need to be using the key property, but I’m not sure what a good natural way to generate the keys. Is this a good use case for metadata on the keys?

noisesmith15:07:03

estsauver: maybe convert the hash-map to a seq of entries, (which reagent is likely doing anyway even if you are not) and put the metadata on the entries?

noisesmith15:07:53

(map #(with-meta % (meta-from-kv %)) m) something like that

noisesmith15:07:20

where meta-from-kv would likely just be first, but whatever works for your app logic

noisesmith15:07:43

or, equivalently, key

estsauver16:07:15

So, @noisesmith if I’m changing the keys the map doing something like clojure.set/rename-keys

estsauver16:07:16

Changing the key would cause the input flicker right?

noisesmith16:07:14

right, so maybe you want the name of the key as the :key, or maybe you want to process them in a separate collection before putting them in the collection the reagent component watches

noisesmith16:07:49

that's what we often do, having a "staging collection" so radical alterations as part of processing don't case hella redraws

timothypratley16:07:17

I find (into [:ul] (for [x xs] [:li x])) pattern pops up a lot for me: react/reagent work better with true vectors than sequences, for the keys reason… using a vector has an implicit key, but a sequence doesn’t. Kind of annoying, but might get you around your issue?

ul16:07:07

When I'm trying to specify :hierarchy in defmulti I get an error Uncaught Error: No protocol method IDeref.-deref defined for type cljs.core/PersistentArrayMap: {:parents {}, :descendants {}, :ancestors {}} doing defmethod for that multimethod. Any ideas?

ul16:07:19

I see in clojure docs example that var should be passed: :hierarchy #'account-types, going to try it

ul16:07:53

Yes, it was the point, sorry for the noise.

rauh17:07:08

@ul Use an atom for the hierarchy.

mfikes20:07:54

@shaun-mahood: Thanks. I’m hoping it helps!

mfikes20:07:05

It was fun to do!

shaun-mahood20:07:17

I'm glad you talked about the library app, my wife is a teacher and literacy specialist with a pretty substantial library. Going to show her your apps and see if they would be useful.

mikethompson20:07:54

@estsauver: I don't really understand the situation you describe, but do you need to generate recoverable keys based on data? Perhaps use https://google.github.io/closure-library/api/namespace_goog.html#getUid

mattly23:07:50

has anyone had an issue with figwheel not picking up on changes to cljc files? I think I have something misconfigured

mattly23:07:01

…I’m also having trouble with said cljc ns in the repl as well