-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
5 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(ns jonase.kibit.rules.performance | ||
(:use [jonase.kibit.rules.util :only [defrules]])) | ||
|
||
(defrules rules | ||
[(reduce + ?coll) (apply + ?coll)]) | ||
This comment has been minimized.
Sorry, something went wrong. |
Going from my (limited) understanding of Clojure and going off the comment in the current version of this file compared against the style of ocmments in other files, I believe this rule might be backwards? As written it's recommending apply instead of reduce.
Edit from Paul // OhPauleez
This rule is correct. Addition for n-ary args is always faster than reduce, because addition is an n-ary operation (and it avoids unnecessary allocations).