<< Back to previous view

[CONTRIB-31] Contribs profiler can run into an Exception Created: 10/Sep/09  Updated: 24/Aug/10  Resolved: 24/Aug/10

Status: Closed
Project: Clojure-Contrib
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect
Reporter: Anonymous Assignee: Stuart Halloway
Resolution: Completed Votes: 0
Labels: None


 Description   

The profile function from clojure.contrib.profile can run into
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


 Comments   
Comment by Assembla Importer [ 24/Aug/10 3:28 PM ]

Converted from http://www.assembla.com/spaces/clojure/tickets/31

Comment by Assembla Importer [ 24/Aug/10 3:28 PM ]

stuart.sierra said: Updating tickets (#1, #2, #3, #4, #6, #20, #23, #25, #30, #31, #33, #34, #35, #37, #38, #52, #55, #58, #59, #60, #61, #62, #63, #64)

Comment by Assembla Importer [ 24/Aug/10 3:28 PM ]

stu said: 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.

Generated at Fri Aug 22 02:53:48 CDT 2014 using JIRA 4.4#649-r158309.