I've been using my own DOM library for a while now which always was fast enough 
for me.

I started a new-ish implementation for my react/om experiments and I started 
using a simple memoization trick to do the "parsing" bit at most once. 
Basically its just (pseudo-ish code, not the actual code)

(defn dom-fn* [kw]
   (let [[tag id class] (parse-dom-tag kw)]
     (fn [] (create-element tag id class)))

(def dom-fn (memoize dom-fn*))

Trades the parsing bits for one map lookup and one extra function invocation, 
seems promising performance wise but too early to tell. Macro proved very 
difficult when I tried it because of the nesting of runtime components which 
you still need an interpreter for anyways.

Also you don't need to use a regexp to parse the :div.something.other a simple 
replace "." with " " yields "something other" which looks alot like the class 
string you want. You can translate that in one single loop over the source 
string which is faster than a regexp but I never did a real benchmark, it 
seemed fast enough. ;)

Maybe these ideas are useful for your library as well, but consider them 
half-baked. I don't have anything to show for it yet. :P

Cheers,
/thomas

On Tuesday, December 9, 2014 10:09:40 PM UTC+1, Julien Eluard wrote:
> Hi Dave,
> 
> 
> dommy removed the templating support from its latest release. In fact hipo is 
> based on the dommy code and try to push it further.
> 
> 
> I am not aware of another library that creates DOM nodes from hiccup using 
> macro to reduce the cost of hiccup parsing . See the original dommy blog post 
> for some context: 
> http://blog.getprismatic.com/the-magic-of-macros-lighting-fast-templating-in-clojurescript/
> 
> 
> Cheers,
> Julien
> 
> 
> 2014-12-09 17:56 GMT-03:00 Dave Sann <[email protected]>:
> can you give a few words as to what is different and why dommy or other 
> similar libs did not meet your needs?
> 
> 
> 
> Dave
> 
> 
> 
> --
> 
> 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