You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In several places, x in A..B is replaced with the non-idiomatic x >= A && x <= B. This is due to the fact that Kotlin/Native does not yet optimize such constructs outside of for-loops. In particular, in LocalTime#ofSecondOfDay about half the time of the function execution was spent in argument validity checks, allocating several objects in the meantime. https://youtrack.jetbrains.com/issue/KT-38787
Parsers are not singleton objects but are instead functions that return newly-constructed parsers. This is done to sidestep a bug that led to an unchecked null value dereferencing as a result of wrong initialization order of values: parser A, referencing parser B, was being initialized before B, which led to it dereferencing a null value.
The text was updated successfully, but these errors were encountered:
Testing revealed that accessing even immutable global variables
concurrently is not supported out-of-the-box and instead crashes
the Kotlin Native runtime. Thus, `SharedImmutable` annotation was
added to every global variable.
Performance fixes include:
* The system timezone is only queried once, after that, it's cached
for the whole life of the thread; Java does something similar,
as, according to
https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html#setDefault(java.util.TimeZone),
the system timezone is only queried at the start of the VM, if
ever.
* Instead of passing strings between Kotlin and native parts,
numeric ids are used. To have a sensible interpretation of such
ids that prohibited their invalidation, Apple and Windows use
additional memory to store the mapping. Moreover, it is assumed
for Apple that the set of timezones and their rules never change,
and for *nix, it is assumed that the timezone objects are always
at the same memory location, which is true for now but will
change if the implementation switches to use C++20 capabilities.
* Most common `ZoneOffset` instances are now cached, which saves
a lot of time due to not having to recompute their string
representation, which is costly in aggregate due to how common
getting anonymous offsets is for operations on datetimes.
* Comparators have been rewritten not to use `compareBy`, which is
comparatively slow.
* `LocalDate` no longer uses `Month` as its main representation of
months, as it is an enum, which are surprisingly slow.
* `LocalDate` used to calculate many additional fields which may
never be required but were nonetheless computed for each instance
of the class. Now, instantiating `LocalDate` is much cheaper at
the cost of several additional fields being computed on each call.
* Some Kotlin-style range checks were replaced with the
corresponding simple comparisons due to a missing optimization
in Kotlin/Native. See
#5
After these fixes, on my machine tests run in 22 seconds instead of
56.
x in A..B
is replaced with the non-idiomaticx >= A && x <= B
. This is due to the fact that Kotlin/Native does not yet optimize such constructs outside of for-loops. In particular, inLocalTime#ofSecondOfDay
about half the time of the function execution was spent in argument validity checks, allocating several objects in the meantime. https://youtrack.jetbrains.com/issue/KT-38787The text was updated successfully, but these errors were encountered: