variable
We were avoiding recomputing it because it used to be a slow operation.
Performance improvements, as reported by the perf testing buildbot:
Histogram -14.07%
StringUtilsUnderscoreCase -10.22%
Dictionary -10.75%
LevenshteinDistance -18.08%
Regressions:
* ArraySubscript 8.56%
This is just bogus. That test does not do any hashing.
* NSDictionaryCastToSwift 6.86%
This test does not do any hashing. It operates only on empty
dictionaries. I believe this is noise.
Swift SVN r23991
Sticking with the original design.
Also added a trap test for removeFirst() since its precondition
is that the set be non-empty, similar to Array.
Swift SVN r23712
rdar://problem/19132138
Make Set<T> visible by removing the underscore. Also, remove the pesky
${_Self} gyb variable that was for a temporary convenience in hiding Set.
Swift SVN r23699
Although Set.any will always return the same element when not modifying
the set, that is an implementation detail. It should be a method.
Swift SVN r23697
Rename in Set<T>:
func removeFirst() -> T
to
func removeAny() -> T?
var first: T?
to
var any: T?
- FWIW, `any` more closesly matches NSSet's `anyObject()` and constructs
in other languages, so `first` seems to be a bit of a surprise.
- `first` implies an ordering of some kind, iterating over `Set` as a
`SequenceType` does have a somewhat reliably "first" element, but it
also has a linguistic tension with the fact that Set<T> is
semantically unordered.
- `first` may be further confused if there ever is an OrderedSet<T>,
which ought to be the first element in its semantic ordering.
Swift SVN r23696
Intersect needs an intermediate set because we need to both traverse
and modify the left-hand side for the in-place operation, which can
invalidate the index.
Swift SVN r23666
The public API is mostly solid at this point, with only a few minor
changes to naming and a couple of extra methods to bring it to parity
with Array.
Also removed the quick-and-dirty operators <, >, <=, and >= which were
used as a convenient shorthand for strict subset, strict superset,
subset, and superset respectively (< is retained for Comparable
conformance).
Swift SVN r23657