Provide an inefficient default implementation and make it "@PublishedApi internal" so it can be safely merged as is.
Intrinsics will be added later in follow-up PRs, and then the implementation will be adjusted accordingly
Merge-request: KT-MR-10843
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
Modification registration seems to changed in Java 9. Now if the asked
capacity in `ensureCapacity` function is less than current capacity,
no modification is registered.
If the found index is odd, retry search from index + 1.
Merge-request: KT-MR-10364
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
- keep offset in range (-1..+1) of time source units
- when adding big or infinite offset, saturate startedAt instead
- displace initial reading to zero, similar to MonotonicTimeSource
- fix the zero reading in TestTimeSource by calling markNow in constructor
- use more precise reading adjustment in TestTimeSource for big durations
- add a note about comparable time marks for AbstractLongTimeSource and TestTimeSource
Sequence::toSet and Sequence::toList both create a
collection, fill it with elements, and then try to optimize a result
by returning empty, singleton, or the allocated collection depending on
the elements count.
Instead of allocating the collection and then trying to return
an optimized instance it is worth checking the sequence's size
beforehand and return empty/singleton collection when possible.
Proposed change optimize performance of aforementioned functions and
also reduce allocation rate when a sequence consists of 0 or 1 elements.
^KT-55091 fixed
Improve the performance of reversed list view iterators by delegating to
underlying list iterators instead of using implementations provided by
the AbstractList.
Latter use AbstractList::get(index: Int) to implement next() and
previous() methods and depending on the underlying list's implementation
it may lead to worse performance.
The change also improves reversed list views test coverage.
- Introduce ComparableTimeMark interface extending TimeMark,
and TimeSource.WithComparableMarks - a time source that returns such time marks.
- Implement ComparableTimeMark in ValueTimeMark and AbstractLong/DoubleTimeMark classes.
The constructors were introduced in jdk7,
thus their usage was prohibited in Common code.
Now that jvmTarget is 1.8 and jdk8+ is used to compile stdlib,
these constructors are available on all platforms.
* Provide short-circuit methods for contract "EnumEntries contains all
enum entries"
* Make EnumEntries serializable
* Introduce more convenient overload for other backends
#KT-53152
Merge-request: KT-MR-6867
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>