Re: Need advice on algorithm performance

2014-12-06 Thread juan.facorro
Hi Dmitriy, There's also an alternative zipper implementation called *fast-zip* [1] which seems to be 5 times faster than *clojure.zip*. Although if *clojure.walk* is faster in an order of magnitude or more than *clojure.zip*, then *fast-zip* won't be much of an improvement. Cheers, Juan [1]

Re: Need advice on algorithm performance

2014-12-04 Thread Dmitriy Morozov
Thanks! clojure.zip is convinient but slow, I used clojure.walk and it turned to be several times faster in my case. On Wednesday, December 3, 2014 10:48:18 PM UTC+2, Jony Hudson wrote: > > If I understand right, I think you might be able to use the existing > replace functions in clojure.walk.

Re: Need advice on algorithm performance

2014-12-03 Thread Jony Hudson
If I understand right, I think you might be able to use the existing replace functions in clojure.walk. I find that this is about twice as fast: (time (dotimes [_ 10] (walk/postwalk-replace {"exp_1" 100 "exp_2" 20 "exp_3" 5} [:DIV [:ADD [:ID "P1" "exp_1"] [:ID "P2" "exp_2"] "

Need advice on algorithm performance

2014-12-03 Thread Dmitriy Morozov
Hi, guys! I have an issue with my function where I use zippers to modify data structure. The function modifies a tree (parsed grammar tree) to replace expressions with values from a given map. Sadly, the algorithm I came up with is pretty slow. I would appreciate if anyone can give me a hint on