This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-21
Channels
- # aleph (5)
- # aws (3)
- # bangalore-clj (1)
- # beginners (8)
- # boot (198)
- # cider (4)
- # cljsjs (5)
- # cljsrn (2)
- # clojure (14)
- # clojure-argentina (1)
- # clojure-dusseldorf (8)
- # clojure-greece (29)
- # clojure-italy (10)
- # clojure-japan (1)
- # clojure-poland (4)
- # clojure-russia (8)
- # clojure-spec (51)
- # clojure-uk (8)
- # clojurescript (97)
- # cursive (4)
- # datomic (6)
- # emacs (2)
- # events (2)
- # figwheel (3)
- # hoplon (32)
- # lein-figwheel (5)
- # leiningen (1)
- # luminus (2)
- # off-topic (29)
- # om (109)
- # other-languages (38)
- # proton (3)
- # re-frame (3)
- # ring (1)
- # slack-help (10)
- # testing (1)
- # uncomplicate (1)
- # untangled (21)
- # vim (10)
- # yada (11)
Hi, is there a way to override ctrl-t and ctrl-w shortcuts in clojurescript in the browser or is it an hopeless quest? (thoses specifically I got the rest working already). I have tried google and trial /error for quite some time without any concluding result (including translating a few javascript snippets that didn't work out).
(only workaround I found so far, for chrome, is starting in application mode google-chrome --app=
@yenda Given the importance of those mappings at the browser level, I doubt you will have much luck. I'm glad applications can't hijack my mappings.
I am implementing keychords so you wouldn't be glad either if C-x C-w closes your application instead of saving the file (or whatever function is assigned but you see the problem here)
10k LOC app, datascript, rum and bidi: :size 702346, :gzip-size 162783, :brotli-size 132157
. I love Clojurescript.
@rauh is that ~160k?
(gzip)
@rauh could probably be further reduced through JS Module consumption
depending if your JS libs would support it
Yeah, I wanna do that eventually. But right now I don't even mind loading code that the client may never use...
160KB is already pretty good
@rauh so I assume this includes HTML templates as well ?
@val_waeselynck I precompile all of the hiccup I use (hacked sablono a bit) so there is only calls to React.createElement
, but yes, they're all included.
@afhammad there’s cljs.core/js-arguments
but you shouldn’t need to use it unless for low-level stuff
right so that should work
yeh it does, was just wondering if there was an alternative or if that was the suggested usage
A confirmation, is it expected behavior that if asset-path
is set to
, then the out folder is searched at
?
I mean, is it expected to be a relative only location to the current server?
@bhauman I’m trying to make an example card show up, but can’t get it working. Gist: https://gist.github.com/borkdude/a74806902bf75aab6060dd7ba87d0382
@bhauman sorry to bother you. I got :figwheel true instead of :devcards true, that was it 🙂
@rauh I am interested in your sablono hacking. Is there a fork somewhere I could peek at?
It's nothing magic, just pruning the interpret
call and then fixing the errors that react gives me by always applying a (html ...)
So rum uses cursors, I think I remember dnolen mentioning some problems with cursors and om, anyone recall what it was?
@rauh If cleaned up, it sounds like it could be a valuable addition to sablono. Many of my components could easily be pre-compiled for speed
so, possibly stupid question: the other day, i mentioned that i was having trouble speeding up a function that converts a 2d js array of booleans into a 2d clj vector of keywords, and we came up with this:
(defn array->grid [an-array]
(into []
(map (fn [row]
(into []
(map (fn [cell]
(if (true? cell) :full :empty)))
row)))
an-array))
and it works great, and profiling indicates that calling it twice accounts for a total of 5% of the time in the main function i’m working on speeding up, which is fine.
but i noticed that profiling also indicates that 30-35% of my function's time is now spent in GC, and my heap size graph looks like this (blue part): https://www.evernote.com/shard/s11/sh/f10c0c33-5bea-42e6-81cb-0d1912b0a8c6/a17df90c6da1cc8b/res/fa1e5447-de13-4eee-9570-39b523c472cb/skitch.png .
when i remove the function’s two calls to array->grid, that 30-35% GC time goes away entirely, and my heap graph stays flat.
is this to be expected / is there no way around this?
the graph above represents 250 calls to the function i’m optimizing, and i likely won’t be calling it more than 5-10 times in real life, so if this unfixable, i suppose i could just ignore / live with the issuelike, i’m not surprised that making a 2d clojurescript vector causes some memory to be allocated, that sounds like just how programming languages work - i am surprised that all of a sudden i’m spending 30-35% of my time in GC though
https://www.evernote.com/shard/s11/sh/d27e3d67-7ce7-456b-ba4d-4e205ea4ab6a/211c1faae7a0c7f3 the graph when the two array->grid calls are removed
if you think about it the heavy work in that code is very likely just allocating new structure
@rauh (or others).. A bit off topic but how did you access Github? Still getting the DNS issues.
@dnolen i definitely buy that - i guess i was just surprised by the magnitude of the effect i’m seeing
i haven’t spent much time thinking about specific memory numbers before, so i don’t have a good gut feeling for what is and isn’t normal
if that looks normal+expected to you, that’s great info for me to have and will help me calibrate my understanding for the future
@jrheard that said this is a good way to know when you might want to choose a mutable data structure for whatever reason
yeah, absolutely - right now i’m using this mutable plain js array to do all of my work, and only converting to the cljs vectors when i’m all done
and so i’m inclined to think that maybe i’m just making an error in my profiling methdology here
this probably won’t be an issue in real life, since i’ll be calling this conversion function much less than i am when i call the whole shebang in a loop a bunch of times
case in point in a typical React CLJS library you’re never going to see GC as the bottleneck
the only time you need to care is really heavy compute stuff, and usually that means data vis / games
achieving 60fps pretty easily atm though, right now i’m working on generating random levels (i.e. that’s the function i’ve been discussing), and that hardly happens every tick of the game loop so i don’t even really need to be worrying about it as much as i am
for anyone else in the room who’s interested, the “tips” section of https://github.com/alexkehayias/chocolatier is very helpful in this context
@jrheard Alex gave a nice talk about that work at ClojureNYC, he said in all the work he had done he didn’t run into any cases where using the game models as immutable data structures themselves were the bottleneck
glad to hear it 😄 yeah, i need to actually work through that “tips” section i linked and actually apply it to my game’s code
ok, i’ve got to head out - thanks again for your time, i really appreciate the sanity check + advice!
@lockdown it offers higher level functionality than ES7 async/await - but yes you can use them to clean up async code in the same way
nice approach from scalajs to use npm libs https://scalacenter.github.io/scalajs-bundler/index.html
@amirrajan nice, i’ve just been using the cljsjs version
@jrheard here is his: https://github.com/oakes/play-cljs I only mention it because he had some traction with play-clj