Re: [ClojureScript] Re: Clojurescript string equivalence in Chrome

2016-02-21 Thread Stephen Nelson
Great job finding and analysing that. I think the appropriate place to
report upstream is https://bugs.chromium.org/p/v8/issues/list. Seeing as
you did the hard work of finding a javascript reproduction you should
submit it and get the credit, but I can if you don't want to follow up on
it.

On Fri, Feb 19, 2016 at 4:47 AM, Francis Avila  wrote:

> At http://dev.clojure.org/jira/browse/CLJS-1574 I added a smaller
> reproducible case that is pure JS. Basically all you need to do is use
> triple-equal with mixed types. The first non-string compare will cause
> subsequent string compares to be slow. If you use == instead there is no
> slowdown. Clearly a chrome/v8 issue.
>
> This code isn't hot, so it's not related to the higher-tier optimizing
> JITs.
>
> On Tuesday, February 16, 2016 at 7:58:51 PM UTC-6, Stephen Nelson wrote:
> > I've had an interesting day debugging a very strange performance problem
> in Google Chrome.
> >
> > http://dev.clojure.org/jira/browse/CLJS-1574
> >
> > ``
> > > (test)
> > cljs equiv:  0.005 seconds
> > > (= :added :ns)
> > false
> > > (test)
> > cljs equiv:  1.517 seconds
> > ```
> >
> > I've never heard of equality causing side-effects before. My suspicion
> is a Chrome JIT bug. Has anyone seen anything like this?
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at https://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.


[ClojureScript] Re: Using require-as with include-macros in self-hosted js

2016-02-21 Thread Mike Fikes
Hi Nikita,

That's interesting. Things work for me (details below). A couple notes:

1) Since quil.sketch requires macros from its own namespace, consuming 
namespaces like quil.core get them for free. In other words, no need to add 
:include-macros true when requiring quil.sketch. If you do (doc ns), you will 
see this concept referred to as "implicit macro loading".

2) Owing to an accident or artifact of the way macros are implemented, 
(cljs.core$macros/or false true) actually works. I haven't investigated why 
this is the case.

So, here is what works for me:

src/quil/sketch.clj:

(ns quil.sketch)

(defmacro defsketch
  [app-name & options]
  `(str "Hello " ~app-name "!"))

src/quil/sketch.cljs:

(ns quil.sketch
  (:require-macros [quil.sketch]))

src/quil/core.cljc:

(ns quil.core
  (:require [quil.sketch :as ap]))

(defmacro defsketch
  [app-name & options]
  `(quil.sketch/defsketch ~app-name ~@options))

And using this from Planck:

$ planck -c src
cljs.user=> (require-macros 'quil.core)
nil
cljs.user=> (quil.core/defsketch "My App")
"Hello My App!"

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.