Scala Native v0.4.0 Release Notes
Release Date: 2019-05-24 // almost 6 years ago-
๐ This release is a first public preview of the features an changes coming 0.4.0 final. Some of the major highlights are listed below, for a full list of changes please see the following page.
๐ Performance improvements ๐
(by @densh and @valdisxp1)
โก๏ธ As announced earlier, Scala Native 0.4.0 is going to feature a brand new whole-program optimizer called Interflow. See the original announcement for additional technical details on how it works under the hood.
โ Additionally, we also have a number of GC performance improvements that made major impact on allocator performance of our Immix garbage collector and also reduce the overhead of the GC metadata. To get best performance one has to use a new flag for enabling LTO across C/Scala boundary
nativeLTO := "thin"
. See the sbt plugin docs for more details.The combination of these two changes gives us following speedups on our benchmarks:
๐ Library improvements and bugfixes ๐ ๐
๐ New regex implementation (by @LeeTibbert, @techaddict, @MasseGuillaume, @densh)
๐ Previously we used to have a dependency on C-based RE2 implementation for regular expressions. In 0.4.0 we've ported the regex engine to Scala to remove that dependency. This would also allow us to narrow the gap between JDK and Scala Native regex treatment over time.
Bundle libunwind with Scala Native (by @shadaj)
๐ Thanks to this change and new regex engine, we don't have any more 3-rd party library dependencies in the core. See latest setup instructions for the simplified environment setup instructions.
๐ New toString implementation (by @LeeTibbert)
๐ Scala Native now uses a port of ulfjack/ryu for floating point to string conversions. This has major performance improvements on benchmarks that rely on this functionality on the hot path as described in the original paper. Additionally make string formatting of
Float
andDouble
much more inline with formatting of the reference on the JVM.๐ Countless other changes to improve library compatibility and fix bugs. See the link in the beginning for the complete list of changes.
๐ฑ Interoperability changes ๐
(by @densh)
0.4.0 is going to feature a revised interoperability layer. Some of the key changes:
- The previous
scalanative.native
namespace has been split intoscalanative.unsafe
,scalanative.annotation
,scalanative.unsigned
andscalanative.libc
. - All of the interop types such as
Ptr
,CStructN
andCArray
are now well-behaved with respect to boxing. This allows those types to be used as elements of Scala collections for example. - All of the interop types are now well-behaved with respect to generics via
unsafe.Tag
(similar toreflect.ClassTag
). This allows one to abstract over elements ofPtr
andCArray
types and perform operations on those elements generically. - ๐
Function pointers have a new SAM-based encoding via
CFuncPtrN
. Unlike previous design new function pointers are aimed primarily at providing callbacks to Scala back from C. They are not compiled as raw C-style function pointer but rather a managed object that gets turned into function pointer on the C boundary. - ๐ Varargs are now compiled to
va_list
instead of C's...
. Support for...
has been dropped. This fixes a number of issues with older vararg implementation making varargs behave well when used together with boxing or generics. _N
accessors don't require additional dereference when used for accessing struct fields. If you used to rely on previous behavior to get a pointer at the field element, useatN
instead.
๐ Tooling and build improvements ๐ง
(by @densh and @LeeTibbert)
- ๐
release
mode has been split intorelease-fast
(faster to compile, less optimizations, best binary size) andrelease-full
(slower to compile, all optimizations, worst binary size).release
mode now aliases torelease-full
. - ๐ new
nativeLTO
,nativeCheck
andnativeDump
sbt settings. See the docs for details. - ๐ improved linking error diagnostics by showing a stack traces that lead to a missing symbol.
- ๐ numerous compilation performance and toolchain scalability improvements.
- resolved a long standing bug (#375) in linking across the JDK boundary via new rewritten reachability analysis.
- โ resolved a long standing bug (#1008) in unit testing layer that used to caused crashes when running with large number of unit tests suites.
- 0๏ธโฃ automatically discover clang 7 and 8 by default.
๐ฑ License change ๐
Similarly to the Scala project itself, Scala Native is now licensed under Apache License 2.0.
Contributors ๐ฅ
๐ According to
git shortlog -sn --no-merges v0.3.8..v0.4.0-M2
, 15 people contributed over 170 pull requests to this release: Denys Shabalin, LeeTibbert, Eric K Richardson, Valdis Adamsons, Darcy Shen, Shadaj Laddad, Nadav Samet, Naohisa Murakami, Paweล Cejrowski, Jorge, Dubray Alexandre, Jimin Hsieh, Jonas Fonseca, Andrew Smith, Lorenzo Gabriele.๐ฑ Thank you all! โจ ๐ฐ โจ
- The previous
Previous changes from v0.3.9
-
๐ This release has been championed by @ekrich to enable ekrich/sconfig and scalameta/scalafmt cross-compiling to Scala Native 0.3.x. Special thanks to him for this effort! ๐
๐ฑ Library improvements ๐
๐ #1419 Add forwarders to support sconfig and scalafmt (by @ekrich)
๐ #1429 Move UnicodeBlock and Subset under Character object (by @thesamet)
#1452 Add java.util.IdentityHashMap (by @ekrich)
โจ #1488 Enhance java.io.File to support URI (by @ekrich)
#1489 Add minimal java.time.Duration (by @ekrich)
#1490 Add unimplemented method to java.util.Properties (by @ekrich)
#1492 Add stubs to URL and URLConnection (by @ekrich)
#1514 Add a few more forwarders to scalafmt to link (by @densh)๐ Bugfixes ๐
๐ #1486 Support assignment to extern variables (by @jonas)
Contributors ๐ฅ
๐ According to
git shortlog -sn --no-merges v0.3.8..v0.3.9
, 4 people contributed to this release: Eric K Richardson, Denys Shabalin, Jonas Fonseca, Nadav Samet.๐ฑ Thank you all! โจ ๐ฐ โจ