Clojurians
#cljs-dev
<
2017-10-14
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

thheller11:10:52

I’m currently trying to track down a weird edge case in the compiler, noticed a few of reader conditionals, eg. cljs.analyzer/resolve-var

thheller11:10:54

(if #?(:clj  (= "js" (namespace sym))
            :cljs (identical? "js" (namespace sym)))

thheller11:10:21

is = so much worse performance wise in JS or why the identical??

mfikes22:10:11

@thheller After self-hosted ClojureScript was introduced, David went through an optimization effort, tweaking things to try to get compilation to run faster

mikethompson23:10:45

@thheller expanding very slightly on mfikes' point ... being able to use identical? instead of = is an optimsation which exploits the underlying platform's treatment of strings. In js environments, strings are interned whereas, on the JVM, they are not. For example ... on a js env this will test true, whereas on the JVM it is will test false: (identical? "hello" (str "hell" "o")) BTW, I'm yet to see someone point to a spec which says that string interning is guaranteed in javascript but, empirically, with all implementations doing it, it seems fairly solid at this point.