Nice! Yes cloneNode looks interesting but in the general case you also
would need to rehydrate properly some data. That cost probably mitigates
the cloneNode benefit but up to some threshold it's still probably
interesting.
I plan to look into that at some point but the rehydration logic is
non-trivial, especially in macro land.

Julien

2014-12-10 15:25 GMT-03:00 Thomas Heller <[email protected]>:

> I got curious, think I found a way to get closer to the macro. Only does
> element contruction no attributes are set except id/className but that
> happens later anyways.
>
> Uses element.cloneNode
> https://gist.github.com/thheller/7faf1c28ca14c9865376
>
> See the related js-perf (not by me)
> http://jsperf.com/clonenode-vs-createelement-performance/32
>
> I reused your parse-keyword function but wrapped into a memoize (well not
> memoize, but as low level as possible) and did a little benchmark.
>
> PARSE: 782.984ms
> CLONE: 141.103ms
>
> Looked nice, altough I did only test Chrome on my Mac. Results probably
> vary on every system but looks like a 4-5x speedup.
>
> Cheers,
> /thomas
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to