This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-14
Channels
- # adventofcode (36)
- # announcements (5)
- # atom-editor (2)
- # babashka (19)
- # beginners (98)
- # biff (7)
- # calva (25)
- # cider (1)
- # cljdoc (10)
- # clojure (70)
- # clojure-czech (1)
- # clojure-dev (14)
- # clojure-europe (79)
- # clojure-nl (1)
- # clojure-norway (8)
- # clojure-seattle (3)
- # clojure-uk (2)
- # clojurescript (28)
- # community-development (44)
- # core-typed (3)
- # cursive (2)
- # datalevin (5)
- # datascript (5)
- # datomic (1)
- # dev-tooling (12)
- # emacs (14)
- # honeysql (3)
- # humbleui (11)
- # introduce-yourself (1)
- # java (1)
- # kaocha (1)
- # lsp (3)
- # malli (21)
- # matcher-combinators (2)
- # nbb (7)
- # off-topic (15)
- # portal (12)
- # reitit (4)
- # releases (1)
- # shadow-cljs (59)
- # sql (8)
- # tree-sitter (3)
I wonder if the perf of expressions like this are impacted by the IDrop
stuff
(take 3 (filter even? (range 100000000)))
Hunch is that this messes with chunking (`even?` is applied to a huge chunk). https://github.com/clojure/clojure/blob/e6fce5a42ba78fadcde00186c0b0c3cd00f45435/src/jvm/clojure/lang/LongRange.java#L120
In 1.11.1 this would be 32
and laziness would be preserved... while the change seems to make that expression be eager
Range never actually eagerly computed values, so nothing has changed there - it just makes one giant chunk rather than n
I did perf test the range changes in a variety of ways and it is much faster in some cases, like reduce and iteration (a wash in others)
filter is still making a chunk of 32
Ahh, perhaps this isn't the case on Clojure master? If I evaluate (take 3 (filter even? (range 100000000)))
in 1.12.1-alpha1, I think I get a huge chunk being evaluated...
Here is a repro... if you evaluate (take 3 (filter (fn [x] (prn x) (even? x)) (range 100)))
you will see 100 applications
Extracting a bit of the logic from filter
this seems relevant: (let [r (range 100)] [(chunked-seq? r) (count (chunk-first r))])
-> [true 100]
Rich and I talked about it today, I'm going to just fall back to making 32-element chunks in range for now, will target that at alpha2