not directly related to cljs dev, but have anyone noticed any performance regressions in Safari/JSC recently? IIRC JSC used to be the most performant engine when benchmarking cljs
@roman01la I haven’t anecdotally, but haven’t done any benchmarks (I run CLJS on JSC with iOS/React Native ). Have you noticed anything?
not sure yet, Safari's devtools doesn't help much to answer the question. Btw is there a way to install an older version of the browser on macOS?
@roman01la I haven't checked recently - what are you observing?
to be clear what I observed was that functional patterns didn't lose
core.logic was fastest on JSC
Not sure, if I have to guess - no.
I think self-hosted had the edge there but not huge
if you looked at persistent data structures directly I think the gap wasn't so significant between JSC & V8
but JSC was definitely faster
and surprisingly close to Clojure JVM
One thing I learned recently is that JSC apparently doesn’t JIT inside of React Native. Only in Safari. Not sure what the implication of that is (if any).
that's always been true
hasn't had any meaningful impact on RN adoption
the interpreters in JSC are not slow
well the one right before the JIT anyway
or two
there's a bunch of levels
RN in general is UI stuff
Yes, it’s not new 🙂 I just recently learned that there’s (some) difference between what iOS does inside of Safari and RN. I used to think “it’s the same”.
not inner loop stuff
so for many apps - can't possibly matter
Yea, I don’t have perf. problems per se. Phones getting faster and faster each year; For most UI stuff you can’t tell the difference at all. And with stuff like Reanimated V2, things really fly anyway (even for UI animation).
in theory it could impact the PD (persisten data structure) stuff
but again, the amount of data you can present to a UI
on a phone is TINY
probably tablets might matter
but tablets are getting as fast if not faster than laptops
Why tablets specifically?
you can present more data
more components etc.
Yeah… still maybe 2x more; not that different.
I'm observing marginally slower runtime performance, but don't want to blame JSC at this point. Either Safari's DevTools are not reliable at tracing or there's something else.
Are you running in browser, RN, or else?
Browser
but I've just asked, maybe someone knows something, don't want to spend anyones time on that, thanks 🙏
No problem 👍 :clojure-spin:
I think I found a bug in transient array map:
ClojureScript 1.10.844
cljs.user=> (def t (transient {}))
#'cljs.user/t
cljs.user=> (doseq [n (range 10)] (assoc! t n n))
nil
cljs.user=> (persistent! t)
{0 0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 6, 7 7}
it seems like any assoc!
after the transient array map has 8 entries are just dropped
@lilactown This is not a bug, you should always use the return value from transient ops, not rely on their side effects
yeah assoc!
still has the same rules as assoc
, must use the returned value
I see. so I'm inferring that what occurs is at > 8 entries it gets promoted to something other than an array map and thus breaks
same problem will occur with hash maps, vectors etc. you cannot mutate in place safely
> Transients support a parallel set of 'changing' operations, with similar names followed by ! - assoc!, conj! etc. These do the same things as their persistent counterparts except the return values are themselves transient. Note in particular that transients are not designed to be bashed in-place. You must capture and use the return value in the next call. https://clojure.org/reference/transients if you wanted to read where that is mentioned
I know the Clojure transients are much faster, but how do ClojureScript transients work? Do they use JavaScript objects underneath?
they work exactly like in CLJ
I meant implementation-wise 🙂
they work like the persistent versions, just mutate in place instead of doing the structural sharing thing
Ah I see; use the same data structure, but mutate in place rather than path copy; Got it.
yes
Yeah that makes sense (doh); otherwise you wouldn’t be able to achieve O(1) transition to a persistent version;