Fork me on GitHub
#re-frame
<
2015-09-20
>
pupeno09:09:00

I just got a very quick and dirty server side pre-rendering working with nodejs, reagent, re-frame doing ajax calls. \o/

colin.yates10:09:04

hi all - any suggestions for profiling a clojurescript app? I am trying to answer “can I process these thousands of tiny events on the UI instead of the server”...

danielcompton11:09:22

@colin.yates: have you looked at the Chrome devtools?

colin.yates11:09:00

@danielcompton: Hiya, not spoken for a while simple_smile. Yes, I find them invaluable for the console and investigating the DOM but I don’t find the performance profiling aspect of them particularly useful… I just end up with a whole bunch of non-application references simple_smile.

danielcompton11:09:49

I think the answer to your question about handling lots of events in the UI is “it depends"

danielcompton11:09:01

At the moment, you’ll probably need to do some preprocessing/batching of the events before you dispatch them to re-frame

danielcompton11:09:28

Depending on what your event/sec rate is

colin.yates11:09:41

They are really useful - thanks Daniel. The app will start off with a single batch of events (which it can chunk internally), after that it will be no-more than say 10 events a second so I think that is fine. It was just that the initial batch might be thousands.

colin.yates11:09:30

essentially it will be (reduce some-fn-that-conds-on-key [big-batch-of-events])

danielcompton11:09:42

sounds like that should be fine

colin.yates11:09:47

and I can time that in Chrome but I wondered whether there was a criterium style library.

colin.yates11:09:16

it needs to be ‘fast’ enough for a wide range of machines including old and dilapitated ones.

colin.yates11:09:26

I shall read those in detail - thanks again Daniel.

danielcompton11:09:53

Not sure if there’s something like Criterium for clojurescript

danielcompton11:09:36

I’m also not sure how relevant it would be for your use case where I imagine the code will start running straight away so it won’t have time to get through the tiered compilation

danielcompton11:09:07

(caveat, I know almost nothing about JS JIT optimisation)

colin.yates11:09:13

no, me neither.

danielcompton11:09:44

I might look at doing the initial compute on the server if possible?

colin.yates11:09:47

I was thinking of getting a page which a set of representative machines could load which would simply print out some stats, the result of something like criterium

colin.yates11:09:12

it is on the server ATM but the great thing of running the events on the client is that stepping back in time is trivial simple_smile.

colin.yates11:09:22

And these events are domain events as well so the world just got really nice

danielcompton11:09:48

Hot off the press

colin.yates11:09:09

gotta run - going to my 8 year old’s birthday party - rock on!

simax9912:09:27

Oops, that should have ‘nest’ controls not ‘next’ controls

wasser15:09:20

@simax Not arbitrarily. Input-text, for example, doesn't support :children, unlike h-box or v-box. But you could set an input-text and a button as :children of an h-box. That's roughly what input-time does, although it just uses a glyph to indicate the interaction model. rather than a button.