Contribs profiler can run into an Exception
The profile function from clojure.contrib.profile can run into
an Exception when it's argument is a lazy sequence.
Reproduce this problem:
an Exception when it's argument is a lazy sequence.
Reproduce this problem:
(use 'clojure.contrib.profile)
(defn foo [x] (prof :foo (+ x 10)))
(profile (map foo (range 5))) ==>
java.lang.IllegalArgumentException: Wrong number of args passed to: core$max
(profile (pmap foo (range 5))) ==>
java.lang.IllegalArgumentException: Wrong number of args passed to: core$max
(profile (doseq [i (range 5)] (foo i))) ==> Works fine
Leave a comment
on 2010-04-12 20:25 *
By stuart.halloway
Assigned to set to stuart.halloway
Milestone changed from Backlog to Release 1.2
Status changed from New to Accepted
The problem isn't lazy sequences, but the absence of any data to report on. Commit 6dd033d9e12337f6630faa3d3f5c2e901a28c4f4 prevents the exception, and causes the printed report to be empty in the case there is nothing to report.
On the calling side, the examples shown above aren't profiling anything, because the lazy calls are never evaluated. You should use some kind of "do" form instead.
On the calling side, the examples shown above aren't profiling anything, because the lazy calls are never evaluated. You should use some kind of "do" form instead.