summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/immutable
Commit message (Collapse)AuthorAgeFilesLines
* Performance improvements for Map4 to HashMap nad Set4 to HashSet transitionsRory Graves2017-03-042-2/+2
|
* Merge commit '0965028809' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-163-22/+140
|\
| * Optimised implementation of List.filter/filterNotRory Graves2017-01-282-0/+106
| |
| * Avoid creating ListBuffer in List.mapConserveRory Graves2017-01-281-20/+31
| | | | | | | | Co-Authored-By: Jason Zaugg <jzaugg@gmail.com>
| * Fix the size of the stack used by RedBlackTree.iteratorFrom.Sébastien Doeraene2017-01-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `s.c.i.RedBlackTree.TreeIterator` uses a stack of nodes that need to be processed later. This stack is implemented as an `Array`, which is allocated with the maximum size that can possibly be used, based on properties of red-black trees. This was added in 72ec0ac869a29fca9ea0d45a3f70f1e9e1babaaf. At the time, there was no `iteratorFrom` method, and as the comment in that commit says, the deepest nodes were never added to the stack, hence the final `- 1` in computing the maximum stack size. However, this changed with the introduction of `iteratorFrom` in 62bc99d3b20a7b37a977b19a6202cdac474eb5f6. The method `startFrom` used to initialize the iterator at the right `start` node does push the deepest nodes in some cases. This internal bug got unnoticed because `pushNext` (originally `pushPath`) has some error recovery in case the stack size got miscalculated. This has performance impacts, though, since an exception is thrown and caught. More importantly, this error recovery mechanism does not work in Scala.js, which considers `ArrayIndexOutOfBoundsException` to be undefined behavior. This commit fixes the stack size computation by simply removing the `- 1` term. To minimize risks on Scala/JVM, the error recovery mechanism is left untouched.
* | Merge commit '8367bf68c1' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-161-1/+1
|\|
| * Fix documentation of immutable.QueueJasper-M2017-01-031-1/+1
| | | | | | `enqueue` appends elements to the `Queue`, it doesn't prepend them.
* | Merge pull request #5522 from ruippeixotog/issue/9886Stefan Zeiger2017-02-081-2/+2
|\ \ | | | | | | SI-9507 Make Stream #:: and #::: allow type widening
| * | SI-9507 Make Stream #:: and #::: allow type wideningRui Gonçalves2017-02-021-2/+2
| | |
* | | Merge pull request #5673 from retronym/topic/hashmap-containsAdriaan Moors2017-02-071-10/+40
|\ \ \ | | | | | | | | Optimizations in immutable.Map.{get, contains}
| * | | Optimizations in immutable.Map.{get, contains}Jason Zaugg2017-02-031-10/+40
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Avoid allocation of Some in get - defer integer left shift until needed - avoid redundantly masking an integer before: Benchmark (size) Mode Cnt Score Error Units HashMapBenchmark.contains 10 avgt 20 284.624 ± 18.985 ns/op HashMapBenchmark.contains 100 avgt 20 3190.580 ± 33.622 ns/op HashMapBenchmark.contains 1000 avgt 20 52967.171 ± 1524.834 ns/op HashMapBenchmark.get 10 avgt 20 248.168 ± 2.612 ns/op HashMapBenchmark.get 100 avgt 20 2795.469 ± 54.458 ns/op HashMapBenchmark.get 1000 avgt 20 52238.773 ± 1268.764 ns/op after: Benchmark (size) Mode Cnt Score Error Units HashMapBenchmark.contains 10 avgt 20 195.107 ± 2.442 ns/op HashMapBenchmark.contains 100 avgt 20 2454.151 ± 24.392 ns/op HashMapBenchmark.contains 1000 avgt 20 40722.993 ± 520.473 ns/op HashMapBenchmark.get 10 avgt 20 245.282 ± 3.547 ns/op HashMapBenchmark.get 100 avgt 20 2729.669 ± 32.767 ns/op HashMapBenchmark.get 1000 avgt 20 49568.410 ± 794.565 ns/op
* | | Merge pull request #5579 from edmundnoble/queue-concatAdriaan Moors2017-02-071-0/+9
|\ \ \ | |/ / |/| | Improve Queue.++ when building another Queue
| * | Improve Queue.++ when building another QueueEdmund Noble2017-01-181-0/+9
| | | | | | | | | | | | Use reverse_:::
* | | Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2016-12-201-2/+7
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20161220 Conflicts: bincompat-backward.whitelist.conf build.xml src/compiler/scala/tools/nsc/typechecker/Typers.scala src/library/scala/collection/immutable/NumericRange.scala
| * | SI-10086 NumericRange.min|max with custom Integral (#5575)Tobias Schlatter2016-12-121-2/+7
| |/ | | | | SI-10086 NumericRange.min|max with custom Integral
* | Merge pull request #5531 from tabdulradi/SI-10060Lukas Rytz2016-12-121-2/+2
|\ \ | | | | | | SI-10060 Fixes NumricRange.max bug on empty ranges
| * | SI-10060 Fixes NumericRange.max bug on empty rangesTamer AbdulRadi2016-11-161-2/+2
| | |
* | | Merge pull request #5527 from som-snytt/fix/use-modern-replaceLukas Rytz2016-12-121-9/+3
|\ \ \ | | | | | | | | String.replaceAllLiterally is String.replace
| * | | String.replaceAllLiterally is String.replaceSom Snytt2016-11-131-9/+3
| |/ / | | | | | | | | | | | | The method is not deprecated outright because it avoids the overloaded equivalent.
* | | Applied further cleanup to VectorPap Lőrinc2016-12-061-56/+63
| | |
* | | Changed >> to >>> in Vector to unify stylePap Lőrinc2016-12-061-118/+118
| | | | | | | | | | | | Unified, since indices are always positive and unsigned shift was already used in other places
* | | Applied suggestions to Vector cleanupPap Lőrinc2016-12-061-179/+161
| | |
* | | Deleted leftover code-comments from VectorPap Lőrinc2016-12-061-93/+20
| | |
* | | Deleted leftover debug method from VectorPap Lőrinc2016-12-061-38/+0
| | |
* | | Unified masks in VectorPap Lőrinc2016-12-061-31/+31
| | |
* | | Removed redundant casts from VectorPap Lőrinc2016-12-061-29/+29
|/ /
* | Typo and spelling correctionsJanek Bogucki2016-11-113-5/+4
| |
* | Improved runtime speed for Vector, restoring previous performance.Rex Kerr2016-11-091-5/+4
| | | | | | | | | | | | All calls to Platform.arraycopy were rewritten as java.lang.System.arraycopy to reduce the work that the JIT compiler has to do to produce optimized bytecode that avoids zeroing just-allocated arrays that are about to be copied over. (Tested with -XX:-ReduceBulkZeroing as suggested by retronym.)
* | Merge pull request #5373 from TimWSpence/2.12.xSeth Tisue2016-10-311-3/+3
|\ \ | | | | | | SI-9909: corrected stream example so it does not give forward reference
| * | SI-9909: corrected stream example so it does not give forward referenceTim Spence2016-10-211-3/+3
| | | | | | | | | | | | error
* | | Merge 2.11.x into 2.12.x, including #5239, #5240Adriaan Moors2016-10-181-0/+1
|\ \ \ | | |/ | |/|
| * | doc: capitalize only works on BMP charactersMartijn Hoekstra2016-06-211-0/+1
| | |
* | | Explicit SerialVersionUID for all ClassTags / ManifestsLukas Rytz2016-09-301-0/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Looking at the class hierarchy around ClassTag and Manifest, the only class that had a serialVersionUID is AnyValManifest, where the hierarchy is something like: trait ClassTag // extends Serializable |- class GenericClassTag |- trait Manifest |- class ClassTypeManifest |- class SingletonTypeManifest |- ... |- abstract class AnyValManifest // has SerialVersionUID |- class DoubleManifest |- ... Note that AnyValManifest is an abstract class, so the SerialVersionUID annotation does not help there. This commit adds explicit SerialVersionUID annotations to (hopefully) all subclasses of ClassTag, to make sure they are stable under compatible changes (such as changing -Xmixin-force-forwarders).
* | Merge pull request #5323 from szeiger/issue/7838-2Seth Tisue2016-08-123-0/+15
|\ \ | | | | | | SI-7838 Document the multi-threading semantics of List and Vector
| * | SI-7838 Document the multi-threading semantics of List and VectorStefan Zeiger2016-08-123-0/+15
| | | | | | | | | | | | Making them completely thread-safe would be too expensive (in terms of performance of single-threaded use cases).
* | | Merge pull request #5306 from szeiger/issue/8576Stefan Zeiger2016-08-121-0/+1
|\ \ \ | | | | | | | | SI-8576 Minimal changes for `-Xcheckinit` compatibility
| * | | SI-8576 Minimal changes for `-Xcheckinit` compatibilityStefan Zeiger2016-08-121-0/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As explained in https://issues.scala-lang.org/browse/SI-8576, I expect serialization compatibility between builds with and without `-Xcheckinit` to be unattainable. This commit contains some minor fixes for issues discovered while running builds with `-Xcheckinit`: - Add `@SerialVersionUID` to `scala.collection.immutable.Vector`, as requested in SI-8576. Note that this does not make `Vector` serialization compatible. - Use lazy initialization for `global` in `PresentationCompilation`. It used to access the uninitialized `self` variable (which seems to be inconsequential in practice and only fails under `-Xcheckinit`). We should consider using `Externalizable` instead of `Serializable` for collections in 2.13 to make collection classes serialization compatible.
* | | Merge pull request #5259 from szeiger/issue/6881Stefan Zeiger2016-08-121-0/+23
|\ \ \ | |/ / |/| | SI-6881 Detect reference equality when comparing streams
| * | SI-6881 Detect reference equality when comparing streamsStefan Zeiger2016-07-071-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `==` already covers this case. We override `equals` in `Stream` to do the same when `equals` is called directly. This takes care of identical streams. To support short-circuiting equality checks on elements prepended to identical streams we also override `sameElements` in `Cons` to treat the case where both sides are `Cons` separately. Tests in StreamTest.test_reference_equality.
* | | Merge pull request #5265 from szeiger/issue/6947Adriaan Moors2016-07-182-86/+85
|\ \ \ | | | | | | | | SI-6947 Better type parameter names for Map classes
| * | | SI-6947 Better type parameter names for Map classesStefan Zeiger2016-07-072-86/+85
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Type parameter names are currently assigned pretty much alphabetically without any meaning. This change renames all key parameters in Map classes from `A` to `K` and all value parameters from `B` to `V` to make them more meaningful. Derived names are renamed accordingly (e.g. `V1` instead of `B1` for an upper bound on `V`, `W` instead of `C` for a new value type). As a side-effect this solves the documentation problem in SI-6947. Due to using `B` both as a type parameter for `foldLeft[B]` in `GenTraversableOnce[A]` and in `Map[A, B]` which extends `GenTraversableOnce[(A, B)]`, the signature of `Map.foldLeft` was rendered in scaladoc as def foldLeft[B](z: B)(op: (B, (A, B)) ⇒ B): B Now you get an unambiguous version: def foldLeft[B](z: B)(op: (B, (K, V)) ⇒ B): B
* | | Merge pull request #5226 from Arneball/sealednessLukas Rytz2016-07-131-1/+1
|\ \ \ | | | | | | | | If Range is sealed, it makes sense to have Range.Inclusive final.
| * | | If Range is sealed, it makes sense to have Range.Inclusive final.Raul Bache2016-06-121-1/+1
| |/ /
* / / SI-9817 forall and existsDmitriy Pogretskiy2016-06-201-0/+8
|/ / | | | | | | | | | | | | | | SI-9817 Immutable queue formatting SI-9817 Added comments SI-9817 Comment formatting
* | Merge pull request #5203 from lrytz/merge-2.11-to-2.12-june-1Lukas Rytz2016-06-021-1/+1
|\ \ | | | | | | Merge 2.11 to 2.12 [ci: last-only]
| * | Merge commit '4196569' into merge-2.11-to-2.12-june-1Lukas Rytz2016-06-011-1/+1
| |\|
| | * SI-9688 Make merge in immutable HashMap1 work with null kv.Łukasz Gieroń2016-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The kv field of scala.collection.immutable.HashMap.HashMap1 can be null. This commit corrects the behavior of updated0 (which is on call path for merged) to work in such cases, instead of throwing NPE. Commit contains regression test.
* | | Merge pull request #5198 from sjrd/privatize-range-membersLukas Rytz2016-06-011-17/+11
|\ \ \ | |/ / |/| | Privatize the deprecated members of `immutable.Range`.
| * | Relax the semantics of `Range.lastElement` for internal use.Sébastien Doeraene2016-05-311-11/+10
| | | | | | | | | | | | | | | | | | `lastElement` is only used in code paths where the range is non-empty. It is therefore wasteful to try and give it a sort of sensible value for empty ranges.
| * | Privatize the deprecated members of `immutable.Range`.Sébastien Doeraene2016-05-311-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation of these obscure members of `Range` are uselessly complicated for the purposes of `Range` itself. Making them private will allow to relax their semantics to the specific needs of `Range`, making them simpler, together with the initialization code of `Range`. `terminalElement` becomes dead code and is removed.