On Sun, Jul 19, 2009 at 10:08 PM, Tim Snyder<[email protected]> wrote: > > I completed a 0.1 version of a Clojure partial evaluator. It consists > of a macro "par-eval" that analyses the form it is passed and replaces > all the sub-forms that can be reduced at macro-expand time with their > reduced versions, provided a printable form exists. > > It can be obtained from git://github.com/larryjoe701/clojure-partialeval.git. > Please feel free to check it out and suggest improvements to its > function and form. > > Function calls, macros, symbols, and most special forms are currently > handled. Things for the next version include the remaining special > forms and collection types and possibly performance improvement for > loop/recur forms. Down the line I plan to include a macro-generating- > macro that will allow for cross-function-level analysis (it is limited > to calling functions where all parameters are known). > > A simple example: > (defn fibb [n] > (if (< n 2) > n > (+ (fibb (dec n)) (fibb (dec (dec n)))))) > > (defn fibb30 [] (fibb 30)) > (defn fibb30* [] (par-eval (fibb 30))) > > (time (fibb30)) >> "Elapsed time: 1353.797291 msecs" >> 832040 > > (time (fibb30*)) >> "Elapsed time: 0.128627 msecs" >> 832040
I'm trying to understand what's going on here and whether the example above demonstrates a real speed improvement. Isn't it the case that fibb30* essentially computes the result before the timer on the last line begins? -- R. Mark Volkmann Object Computing, Inc. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
