Scala Native v0.4.0 Release NotesRelease Date: 2019-05-24 // 5 months 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 👟
⚡️ 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 📚 🐛
🚚 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
Doublemuch 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 🎌
0.4.0 is going to feature a revised interoperability layer. Some of the key changes:
- The previous
scalanative.nativenamespace has been split into
- All of the interop types such as
CArrayare 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
reflect.ClassTag). This allows one to abstract over elements of
CArraytypes 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_listinstead 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.
_Naccessors 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, use
🏗 Tooling and build improvements 🔧
releasemode has been split into
release-fast(faster to compile, less optimizations, best binary size) and
release-full(slower to compile, all optimizations, worst binary size).
releasemode now aliases to
- 🆕 new
nativeDumpsbt 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.
🚀 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
🍱 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 🐛
🚀 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! ✨ 🍰 ✨