clojure.core/set should use transients

Description

CLJ-1384-p2 uses transients for both create and createWithCheck. This is consistent with the current implementation for map.

clojure.core/vec calls (more or less) PersistentVector.create(...), which uses a transient vector to build up the result.

clojure.core/set on the other hand, calls PersistentHashSet.create(...), which repeatedly calls .cons on a PersistentHashSet, with all the associated speed/GC issues.

Operation

count

now

w/transients

set

5

1.771924 µs

1.295637 µs

into

5

1.407925 µs

1.402995 µs

set

1000000

2.499264 s

1.196653 s

into

1000000

0.977555 s

1.006951 s

Patch: CLJ-1384-p2.patch
Screened by: Stu

Environment

None

Assignee

Unassigned

Reporter

gfredericks

Labels

Approval

Ok

Patch

Code

Fix versions

Affects versions

Priority

Major
Configure