distinct? throws clojure.lang.ArityException, when applied with no arguments

Description

HSQLDB returns an empty ResultSet when using (.getGeneratedKeys stmt)
and no keys are generated. So this Exception is thrown for each record
without generated keys.

While this Exception is caught in do-prepared-return-keys, this can lead to a huge overhead caused by the JVM exception handling. I did a performance test.

Before Patch:

clojure.java.test-jdbc> (time (sql/with-connection hsqldb-db (count (apply sql/insert-records :dummy (map #(hash-map :name (str %) :id %) (range 10000)))))) "Elapsed time: 3429.346743 msecs" 10000

After Patch:

clojure.java.test-jdbc> (time (sql/with-connection hsqldb-db (count (apply sql/insert-records :dummy (map #(hash-map :name (str %) :id %) (range 10000)))))) "Elapsed time: 1397.444753 msecs"

Environment

None

Attachments

2
  • 12 May 2012, 05:51 PM
  • 12 May 2012, 05:51 PM

Activity

Show:

Sean CorfieldJune 10, 2012 at 11:24 PM

Thanx for the patch!

Completed

Details

Assignee

Reporter

Patch

Code and Test

Priority

Created May 12, 2012 at 5:51 PM
Updated June 1, 2016 at 6:41 PM
Resolved June 1, 2016 at 6:41 PM

Flag notifications