If anything is an order of magnitude slower than Clojure it should be considered a bug and be filed as such. We're shooting for w/in 2.5X for all operations.
`vector` is slow and can easily be dramatically improved. I suspect there's something up with record creation and it should be looked into. You might want to compare with construction time of a deftype instance, I see little reason why records can't be constructed as quickly. Also what optimization settings are you using? David On Tue, Nov 5, 2013 at 10:38 PM, kovas boguta <kovas.bog...@gmail.com>wrote: > I'm trying to optimize zippers for clojurescript. My benchmark is > implementing the combinator systems from > > https://www.wolframscience.com/nksonline/page-102 > > which heavily stress both navigating and modifying the tree. > > A major hotspot seems to be data structure creation time, which can be > between 10 and 200x slower than jvm. I'm using Chrome 30.0.1599.101 . > > Vectors: > (time (dotimes [x 1000000] ( vector x))) > cljs: 2175 msecs > clj: 11.414 msecs > > strangely, apply is faster for cljs : > (time (dotimes [x 1000000] (apply vector [x]))) > cljs: 1175 msecs > clj: 64.919 msecs > > into gives about the same result for cljs. > > Creating a datastructure literal (eg [x]) is about 5x slower in cljs > over clj, which I would take, however in the zipper case the number of > children can vary dynamically. > > Lists: > (apply list [x]) is about 2x faster than the vector case in cljs, and > within about 5x of the jvm speed. Unless there is a better idea, I may > try a specialized list-oriented zipper and see how it performs. > > Records: > Creation is about ~10x slower than in clj. What's weird is that > creating hashmaps is actually marginally faster than creating records > (however, records still have much faster field access, so I'm using a > record-based zipper implementation) > > (defrecord Test [a]) > (time (dotimes [x 1000000] (Test. x))) > cljs: 60 msecs > clj: 7.00 msecs > > Is there a trick to speed up vector and/or record creation? Should I > look into a custom datastructure? > > Any ideas welcome. > > Thanks! > > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.