Rust Coreutils 0.7: Turbo for the command line
The Rust reimplementation of classic Unix tools reaches version 0.7 with numerous performance improvements and build fixes for NetBSD and PowerPC.
(Image: heise medien)
The developers of Rust Coreutils have released version 0.7. The focus of the update is on performance optimizations that extend across dozens of utilities. Improvements include faster hash maps, new ASCII fast paths, and reduced malloc calls for various commands. Additionally, the developers have integrated build fixes for NetBSD and PowerPC.
Another focus of the version is the reduction of unsafe code. Specifically, the developers have replaced unsafe libc code with safe Rust abstractions, further increasing the security of the implementation. This builds on the work of the predecessor version 0.6, which had already eliminated buffer overflows and use-after-free errors through Rust's ownership system. Version 0.7 also eliminates panics when writing to /dev/full in over 20 utilities such as echo, date, and sort, further increasing production readiness.
GNU compatibility decreases proportionally
In terms of compatibility with the GNU Test Suite, version 0.7 shows an apparent setback: the pass rate dropped from 96.3 percent in version 0.6 to 94.6 percent. However, this decline is explained by the integration of 19 new tests from GNU Coreutils 9.10. The absolute number of passed tests has increased despite the lower percentage. Furthermore, six additional tests were skipped and seven more tests failed.
Videos by heise
The proportional decrease is normal given the evolving reference test suite. The new tests from GNU Coreutils 9.10 are more difficult to pass than the previous ones, which is why the pass rate is decreasing while the implementation is passing more tests in absolute terms. Nevertheless, the Rust-Coreutils project still aims for complete GNU compatibility of 100 percent. The developers are working closely with the GNU project and have contributed numerous patches to GNU Coreutils, strengthening both projects.
Performance improvements in detail
The performance optimizations in version 0.7 should be measurable for system administrators and end-users, especially in batch operations with many files, processing large amounts of data, and repeated calls to utilities in scripts. Specifically, for example, unexpand offers a 14 percent speed increase, du between three and six percent, and shuf around four percent. The faster hash maps speed up operations that rely on key-value mappings. The new ASCII fast paths optimize the processing of ASCII characters, which constitute the majority of the processed data in many use cases.
Reduced malloc calls lead to less memory fragmentation and potentially shorter CPU activity times, which positively impacts overall performance. These optimizations are part of a continuous development process: in version 0.6, the base encoding utilities like base32 and base64 were already accelerated, and version 0.4 introduced specific optimizations for factor, cksum, tsort, and mkdir.
The release notes for version 0.7 are available on GitHub.
(fo)