Skip to content

Commit

Permalink
[jdbc.row] Reduce allocations in fetch-all-columns! (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-yakushev authored Oct 14, 2024
1 parent 913ff6a commit 3729d20
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/toucan2/jdbc/row.clj
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,12 @@

(defn- fetch-all-columns! [builder i->thunk transient-row]
(log/tracef "Fetching all columns")
(reduce
(partial fetch-column! builder i->thunk)
transient-row
(range 1 (inc (next.jdbc.rs/column-count builder)))))
(let [n (next.jdbc.rs/column-count builder)]
(loop [i 1
transient-row transient-row]
(if (<= i n)
(recur (inc i) (fetch-column! builder i->thunk transient-row i))
transient-row))))

(defn- make-realized-row-delay [builder i->thunk ^clojure.lang.Volatile volatile-transient-row]
(delay
Expand Down

0 comments on commit 3729d20

Please sign in to comment.