Commit Graph

20 Commits

Author SHA1 Message Date
Dmitri Hrybenko
4f819a9cf7 Remove an NSSet.copyObjectPointers() API that was unintentionally added
Swift SVN r24054
2014-12-20 03:01:34 +00:00
Maxwell Swadling
b6cd6ebda8 [stdlib] Removed bidirectional iterator from Dictionary and Set
Swift SVN r24023
2014-12-19 00:22:15 +00:00
David Farler
1766dd71ed Use Set([...]) as Set's description, debugPrint elements
Don't use {. . .} as Set's description - use:

Set([1, 2, 3]) and debugPrint the elements.

rdar://problem/19299943

Swift SVN r24021
2014-12-19 00:01:38 +00:00
Dmitri Hrybenko
e5c3b534fe stdlib/HashedCollections: don't save the NativeStorage in a local
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
2014-12-17 22:17:59 +00:00
David Farler
324411a44b Don't trap when creating a Set from a literal with duplicate elements
rdar://problem/19178760

Swift SVN r23791
2014-12-08 23:09:04 +00:00
David Farler
16633eac05 Rename any/removeAny to first/removeFirst
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
2014-12-05 01:42:45 +00:00
David Farler
e7506e8eab Remove underscore from _Set<T>
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
2014-12-05 00:21:35 +00:00
David Farler
ad67a452dc Set.any should be a method
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
2014-12-05 00:01:21 +00:00
David Farler
e1dd3bad59 Set: Rename removeFirst -> removeAny and first -> any
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
2014-12-04 23:54:57 +00:00
David Farler
419afc489b Add performance FIXME for Set.intersect
Swift SVN r23675
2014-12-04 02:12:07 +00:00
David Farler
85f300609b Add exclusiveOr, exclusiveOrInPlace to Set<T>
rdar://problem/19124388

Swift SVN r23674
2014-12-04 02:06:19 +00:00
David Farler
76c5937b6c Build fix: Don't invalidate Set index during intersect
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
2014-12-04 00:28:48 +00:00
David Farler
f9eb39cee3 Remove Comparable from Set<T>
Swift SVN r23663
2014-12-03 23:16:27 +00:00
David Farler
6757a7d7f6 Commit next revision of Set<T> public API
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
2014-12-03 22:22:24 +00:00
David Farler
7493240117 Add any() -> T? to Set
rdar://problem/19062929

Swift SVN r23599
2014-12-01 22:08:51 +00:00
Joe Groff
b60a30c84b stdlib: Make isUniquelyReferenced shims properly return bool.
rdar://problem/18573806 is fixed.

Swift SVN r23547
2014-11-22 05:36:38 +00:00
David Farler
2539ebdabf <rdar://problem/18979003> _Set([1,2,3]) crashes in Xcode playground: assertion in IDEPlaygroundQuickLookForStructure.m:405
Swift SVN r23319
2014-11-14 02:32:35 +00:00
Dmitri Hrybenko
4cd60e6b4e stdlib/Set: add #if guards for non-ObjC platforms
Swift SVN r23266
2014-11-12 09:05:39 +00:00
David Farler
d0718c69fc Prefix Set<T> with underscore for API development
Swift SVN r23263
2014-11-12 07:07:01 +00:00
David Farler
c453eb4c48 Add Set type.
<rdar://problem/14661754> TLF: [data-structure] Set<T> data type + Bridging from NSSet

Swift SVN r23262
2014-11-12 07:07:00 +00:00