Start by putting your code on github or something similar :)
On Apr 14, 8:01 pm, Chris <ccons...@gmail.com> wrote:
> While playing around with clojure I've found the (time ...) macro
> isn't as powerful as I'd like. To fix this I made a timing library to
> help me figure out where all my runtime is going. If other people
> find it useful I'd like to get it into contrib.
>
> Simple overview of clojure.contrib.timing:
>
> clojure.contrib.timing/with-timing
> ([expr {:name :timing-map}])
> "Executes 'expr', returns result of expr, and records its time to
> execute. Each time to execute is saved for processing later. This
> allows you to get mean/median/mode/cumulative runtimes for the
> expression.
> - expr: The expression to evaluate
> - name: value to name expression, defaults to (str expr).
> timing-map: Reference to a map of recorded timings. Defaults to
> the shared global *timings."
>
> clojure.contrib.timing/analyze-timing
> "Returns a hashmap of 'name' : '(analysis-func timing-list)'. All
> times are converted to milli seconds. If timing-map is not given it
> defaults to the shared global *timings*."
> ([analysis-func timing-map]
>
> There are some other helper funcs/macros, but the above two are the
> most important. Future work here could give us a nice performance
> timing library written in clojure, and powerful enough to allow
> clojure programs to know how fast they are and tune themselves (think
> serialized vs. parallelism, hostnames to connect to, etc...).
>
> The timing-map is a ref to a map. Each value is a list of every
> runtime of the expression. Every time the expression runs it's time-
> to-run is cons-ed to the front of that expression's timing list.
>
> Storing of the runtime into the ref is a side-effect of (with-
> timing ...). I was torn on this point, but I think it's the right
> thing to do for now; performance is a side effect of code execution,
> so it isn't that horrible for it to be stored as a side-effect. This
> is how the original (time ...) macro works; it reports the runtime to
> stdout instead of returning it.
>
> I'm not sure what the protocol here is for getting this thing out for
> review and possible inclusion. Is anyone interested? How do I get my
> changes out there for people to review?
>
> Thanks!
> Chris
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---