map-invert should use transients and reduce-kv instead of reduce

Description

Two performance enhancements on clojure.set/map-invert:

1) Use reduce-kv to avoid realizing mapentry's from input map
2) Use transients to create the output map

Perf:

Patch: clj-1808-map-invert-should-use-reduce-kv-and-transient.patch

Screened by: Alex Miller

Environment

None

Activity

Show:
Alex Miller
September 4, 2015, 4:42 PM

Would be nice to see a quick perf test that compared before/after times.

Assignee

Unassigned

Reporter

Nikita Prokopov

Labels

Approval

Screened

Patch

Code

Fix versions

Priority

Minor