It turned out that using unsigned numbers is heavy both in terms of size and performance.
We can consider switching back (KT-58041) as soon as we implement unsigned numbers and operations using wasm built-in capabilities (KT-58039).
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
Add a special annotation @JsExternalTypeArgument for
marking function parameters. The marked parameter
accepts an argument with an external type only.
^KT-57479 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.
* Fix performance of ArrayList.addAll methods in JS stdlib: extend the backing array and copy elements manually
* Update expected reachable nodes after DCE in test data
---------
Co-authored-by: Ilya Gorbunov <ilya.gorbunov@jetbrains.com>
Add a special annotation @JsExternalInheritorsOnly for marking
external interfaces and classes. The marked interface or class
can’t be a parent for non external interfaces, classes or objects.
^KT-57423 Fixed
* Addresses the recent design changes of the corresponding language feature
* Also rework JS/Wasm enumEntries implementation with the function that accepts array instead of fabric function
^KT-57318
Co-authored-by: Artem Kobzar <Artem.Kobzar@jetbrains.com>
Merge-request: KT-MR-9204
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
- Generated types extend JsAny
- Use JsAny instead of Dynamic
- Use JsArray instead of Array
- Use JsNumber, JsString and JsBoolean in JsAny context
- Refactor dictionary constructor functions
Before external classes could only represent JS object types and are
type-checked with `instanceof`.
@JsPrimitive allows external classes to represent primitive types with
`typeof` checks.