Re: Performance Patterns

2013-07-17 Thread Gary Trakhman
I have a variant of the timings macro that I used to profile some numeric code recently. You sprinkle it in your code, and it aggregates timings during a run by keywords of your choice.: (def ^:dynamic *times* nil) (defmacro timek "Evaluates expr and prints the time it took. Returns the va

Re: Performance Patterns

2013-07-17 Thread Marc Dzaebel
Frantisek, your timings macro is really helpful and you already have many interesting examples in the code. So I combine yours, mine and Alex recommendations as: - Programmatic creation of tests/docs to adapt to current Clojure versions - Systematically organized/grouped/sorted samples - Comment

Re: Performance Patterns

2013-07-17 Thread Marc Dzaebel
- really helpful links - accepting performance as more relevant, would IMHO strengthen Clojure So your wishes would be: - Systematically organized samples - Comments on causation - Using libraries to increase quality Thanks for your help, Marc -- -- You received this message because you are su

Re: Performance Patterns

2013-07-15 Thread Frantisek Sodomka
For my own needs, I wrote a macro 'timings' - see Timing expressions and comparing results: https://groups.google.com/d/msg/clojure/o8pOLc6uxQQ/bui7sJ-F5_wJ Code and examples are here: https://gist.github.com/fsodomka/5890711 Your examples on my machine with Clojure 1.5.1: (report (let [x 2 y [

Re: Performance Patterns

2013-07-15 Thread Alex Fowler
I would definitely like to have such a reference because I often work with performance-critical code which I mostly delegate to Java. I would like to see it organized in categories for easier access, with commentaries to each case on why is this so (for example, i would suppose that aset-int sho

Performance Patterns

2013-07-14 Thread Marc Dzaebel
I'm often in need of performance comparisons/recommendations about different ways to code the same usecases. E.g. (time(let [x 2 y [0 1 2 3 4]] (dotimes [_ 1000] (remove *#{x}*y ;~950 ms (time(let [x 2 y [0 1 2 3 4]] (dotimes [_ 1000] (remove *#(= % x)*y ;~150 ms (time(let