| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
SI-6253 HashSet should implement union
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Implements of HashSet.union that reuses the two trees as much as
possible when calculating the union of two sets. This leads to significant
performance improvements as well as to much better structural sharing.
There is a comprehensive correctness test for union since there was not a single test
for HashSet.union before. In addition, there are some tests of the desirable
properties of the new implementation (structural sharing and efficiency
regarding calls of key.hashCode).
The other operations diff and intersect, which are conceptually very
similar to union, are also implemented along with comprehensive test cases
for both correctness and structural sharing.
Note that while it appears that there is some code duplication between the
three methods, they are sufficiently different that it is not possible
to merge them into one without sacrificing performance.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
Int.MaxValue
Fixed by rewriting the entire logic for the count method. This is necessary because the old code was making all kinds of assumptions about what numbers were, but the interface is completely generic.
Those assumptions still made have been explicitly specified. Note that you have to make some or you end up doing a binary search, which is not exactly fast.
The existing routine is 10-20% slower than the old (broken) one in the worst cases. This seems close enough to me to not bother special-casing Long and BigInt, though I note that this could be done for improved performance.
Note that ranges that end up in Int ranges defer to Range for count. We can't assume that one is the smallest increment, so both endpoints and the step need to be Int.
A new JUnit test has been added to verify that the test works. It secretly contains an alternate BigInt implementation, but that is a lot slower (>5x) than Long.
|
|\
| |
| | |
SI-6196 - Set should implement filter
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is the exact same algorithm as in SI-6196, with only slight
differences due to the two type arguments of HashMap.
Filter is tested by the new comparative collection test by @Ichoran, but
there is nevertheless a small correctness test in t6200 in addition to
tests of the new desirable behavior.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Implements a version of filter and filterNot that reuses as much as
possible from the existing tree instead of building an entirely new one
like the builder-based filter does. This results in significant performance
improvements on average.
Adds a test of basic correctness of filter and filterNot as well as of the
desirable properties of the new filter implementation.
This is a collaboration between me and @Ichoran
|
|\ \
| | |
| | | |
SI-7544 StringContext.f docs update
|
| | |
| | |
| | |
| | |
| | | |
Correct the scaladoc to reflect how f"%" is handled,
namely, it's no longer taken as f"%%".
|
|\ \ \
| | | |
| | | | |
SI-6457 ImmutableSetFactory.empty results in StackOverflowError
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
ImmutableSetFactory relies upon empty to create its builder, which in turn relies upon its builder to create an empty. Added an emptyInstance method to hold the actual empty set (which also removes duplicated functionality for empty sets).
No test, as the original pattern:
object Factory extends collection.generic.ImmutableSetFactory[collection.immutable.Set] {}
no longer compiles. This should be verified by whoever checks this commit, but this kind of change is hard to revert by accident. No reason to waste resources checking it forevermore.
|
|\ \ \ \
| | | | |
| | | | | |
Quasi-comprehensive BigDecimal soundness/correctness fix.
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This fixes issues SI-6153, SI-6173, SI-6456, SI-6699, and SI-8116, along with a number of other similar possible issues.
Relevant changes include
* Changes to avoid heap explosion when working with BigInt
- to isWhole
- to hashCode
- to equals
- to BigInt's equals
* Changes to enable equality matching hashCode
- Only for sufficiently small BigInt
- For identical values with different precision
* Changes to isValidDouble
- Takes precision into account now
- New methods added to test whether even if the Double is not represented exactly, it's a representation of a certain type
- New companion methods added to allow intended expansion of Double (binary/decimal difference)
* Changes to constructor
- Null arguments are not allowed (these can throw NPEs later at awkward/unexpected times)
* New JUnit test to test all these things
* Fixed existing tests to expect new behavior
* Modified scaladocs to explain the issues
* Deprecated problematic methods
* Made application of MathContext more consistent (it is where you expect it and not where you don't)
These changes are coordinated, for the most part, hence the monolithic
commit.
|
|\ \ \ \
| | | | |
| | | | | |
SI-8100 - prevent possible SOE during Stream#flatten.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This commit changes stream flatten to avoid allocating a
stack frame for every stream item. Previously, flattening
a stream whose elements are mostly empty would result in
a StackOverflowException.
This commit also adds a test demonstrating the problem.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Remove misc. @deprecated elements
|
| | | | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-8107: Add Regex.quote
|
| | | | | | | |
|
| | |/ / / /
| |/| | | | |
|
|\ \ \ \ \ \
| |_|_|_|_|/
|/| | | | | |
SI-8081 unzip/unzip3 return wrong static type when applied to Arrays
|
| | |_|/ /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | | |
Added unzip and unzip3 methods to ArrayOps so that we get proper return
values. (No tests due to unfavorable effort/reward ratio for an ongoing
test of something so simple.)
|
|\ \ \ \ \
| |_|_|_|/
|/| | | | |
Implements specialized subsetOf for HashSet
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Added some more general documentation about how levels work and how the
bitmap field encodes the position of elems.
|
| | |/ /
| |/| |
| | | |
| | | | |
Fixes SI-7326. This also adds a basic test for subsetOf that was missing before.
|
|\ \ \ \
| |_|/ /
|/| | | |
Removes TODO comments that are no longer applicable
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
- we do not want to use mutable updates because that would mean making vals
vars, losing various guarantees for final fields of the java memory model
- we do not want to add more subcasses of HashSet, because that would make
callsites megamorphic. If anything, we should try to reduce the number of
subclasses
- checking for monomorphic call site is not worth it for a single virtual
method call.
|
|\ \ \ \
| | | | |
| | | | | |
Fixes SI-6615, NPE on slice of PagedSeq.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
been computed yet
Made sure to addMore when roving forward on a slice into unpaged territory.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Resolves SI-6364, O(n) performance of wrapped set contains.
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
O(n) performance of wrapped set contains was the problem.
Added overrides for contains and isEmpty to SetWrapper. Note that sets are
invariant in Scala, while the Java signature is for any Object, so we trap
a ClassCastException if one occurs. (Is this everything that could possibly
go wrong? I think so, but am not as confident as I would like.)
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Update the ScalaDoc entry page of the Scala library
|
| | |_|/ /
| |/| | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Fixes #3330 with Scaladoc changes only
|
| | |_|/ /
| |/| | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Fix SI-7443 Range.sum ignoring Numeric argument and always assuming default 'plus' implementation
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Previously both Range and NumeriRange used formula for sum of elements
of arithmetic series and thus always assumed that provided Numeric is
regular one.
Bug is now fixed by conservatively checking if Numeric is one of
default ones and the formula still holds.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Remove temporary binary compat scaffolding from AbstractPartiionFun.
|
| | |_|_|/
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
These were only needed during the transition period when we removed
specialization on AnyRef from `AbstractPartialFunction`.
It's time to cast away the crutches.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Fix typo in documentation
|
| |/ / / / |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-7491 fix typo in scala.App documentation
|
| |/ / / /
| | | | |
| | | | |
| | | | | |
App.main should never be overridden, so let's enforce it.
|
|/ / / /
| | | |
| | | |
| | | | |
Value class member need not be public in 2.11+
|
|\ \ \ \
| | | | |
| | | | | |
SI-7492 Make scala.runtime.MethodCache private[scala]
|
| |/ / /
| | | |
| | | |
| | | |
| | | | |
These are internal implementation details which shouldn't be exposed
to users (and might go away when support for invokedynamic is added).
|
|\ \ \ \
| | | | |
| | | | | |
Fix (postfix abs for -0.0)
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | | |
SI-8102 points out that -0.0.abs returns -0.0 (in error). The same issue
exists for -0.0f. This commit fixes the issue for both by delegating to
math.abs.
|
|\ \ \ \
| |/ / /
|/| | | |
Resolves SI-7837, failure in quickSort.
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | | |
because the code uses '==' instead of 'equiv'
== instead of equiv (from Ordering) was used by mistake. Fixed.
Also created a test to make sure that == is not used by throwing an exception if it is (as suggested by Jason).
|
|\ \ \
| | | |
| | | | |
Fix typos in documentation
|