Skip to content

Commit

Permalink
Performance fix for cumulative operations.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuernber committed Jun 10, 2021
1 parent a270b7e commit 9eb94a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tech/v3/datatype/functional.clj
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,11 @@
result (double-array n-elems)
filter (dtype-reductions/nan-strategy->double-predicate
(:nan-strategy options :remove))]
(when-not (== 0 n-elems)
(when-not (pmath/== 0 n-elems)
(loop [idx 0
any-valid? false
sum (.readDouble data 0)]
(when (< idx n-elems)
(when (pmath/< idx n-elems)
(let [next-elem (.readDouble data idx)
valid? (boolean (if filter (.test filter next-elem) true))
sum (double (if valid?
Expand All @@ -375,7 +375,7 @@
(if valid?
(ArrayHelpers/aset result idx sum)
(ArrayHelpers/aset result idx next-elem))
(recur (unchecked-inc idx) (or any-valid? valid?) sum)))))
(recur (unchecked-inc idx) (clojure.core/or any-valid? valid?) sum)))))
(array-buffer/array-buffer result)))


Expand Down

0 comments on commit 9eb94a6

Please sign in to comment.