This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-18
Channels
- # adventofcode (40)
- # aleph (8)
- # announcements (2)
- # beginners (27)
- # calva (3)
- # cider (3)
- # clj-kondo (21)
- # cljsrn (9)
- # clojure (122)
- # clojure-europe (38)
- # clojure-france (93)
- # clojure-nl (2)
- # clojure-spec (1)
- # clojure-uk (32)
- # clojuredesign-podcast (1)
- # clojurescript (12)
- # community-development (11)
- # conjure (14)
- # cursive (11)
- # datalog (7)
- # depstar (21)
- # emacs (31)
- # fulcro (85)
- # google-cloud (1)
- # graalvm (1)
- # graphql (7)
- # jobs-discuss (3)
- # joker (1)
- # kaocha (14)
- # pathom (2)
- # re-frame (1)
- # reagent (1)
- # reitit (6)
- # reveal (50)
- # shadow-cljs (64)
- # spacemacs (8)
- # tools-deps (5)
I have this challenge from the book "Clojure from the ground up"
Write a function which, in a dosync transaction, removes the first number in work and adds it to sum.
Then, in two futures, call that function over and over again until there's no work left. Verify that @sum is 4999950000
anyone a idea what the two futures should do and why 2 futures
So far I have this :
(def work (ref (apply list (range 1e5))))
(def sum4 (ref 0))
(defn sum_sync []
(dosync
(let [first (first work)
rest (rest work)]
alter sum4 + first)
))
the 2 futures execute the processing in separate threads, i guess it is to demonstrate that changes within a transaction are atomic
oke, so one future for updating sum and one for removing a item from work ? @chrisblom
How to check for performance issue or where time is being spent? I have 2.3 million rows in db. Loaded one column of big decimal type and running cumulative sum on it and then passing it to incanter line charts. It's been going on more than an hour, but no result so far.
> (def csum (cumulative-sum
(map #(:resp %)
(jdbc/execute! ds ["select resp from train_data"]
{:builder-fn rs/as-unqualified-lower-maps}))))
> (charts/line-chart (range 0 (count csum)) csum)
Using Visualvm I can see on heapspace chart moving up and down. also object count is pretty much constant by looking at multiple heap dump. Only 8GB of ram is used and also htop shows only 1 core active out of 8.1. csum
is fully realized at the point you call line-chart
?
2. If you evaluate all the 2M rows I guess incanter can have issues producing a chart with so many values.
@phoenixai2082 did you try profiling or sampling in visualvm?
As a brand new Clojure programmer and IntelliJ/Cursive user... How do I profile my code to figure out what is eating up CPU cycles or allocations?
^ That's a good one. Assuming that the bottleneck is CPU. Here's a very recent and long webinar about Async Profiler https://www.youtube.com/playlist?list=PLNCLTEx3B8h4Yo_WvKWdLvI9mj1XpTKBr
I can get my code running with a "Run/Debug Configuration" no problem, but the "Run with CPU profiler" option tells me Deferred configurations cannot be run with standard runners
and I'm not sure I get what that means...
Hi, I don't know if this is the right channel to ask this but here goes I'm planning on developing a mobile app. I could just work with JavaScript and React Native, but I want to try ClojureScript with React Native. Does anyone here have any experience developing mobile app with ClojureScript and React Native, either through work or personal project? I would love to know what framework I should use. I've been doing research but seems like re-natal is no longer maintained and krell is too early in development with not that much documentation?
@tuananh.le #cljsrn would be the channel for React Native + CLJS
@tuananh.le Yes and in addition to the channel, you add this website/page https://cljsrn.org/ There have been 2 very good videos recently added in the "Talks & Videos" section.