Post B6NPaBfg6QLPJlsTvU by matt@toot.cafe
(DIR) More posts by matt@toot.cafe
(DIR) Post #B6NPa8yM8WVCwpar7g by matt@toot.cafe
0 likes, 0 repeats
I'm ambivalent about Rust these days.On the one hand, I love Rust's approach to safety. Meaning type safety, memory safety, and protection against data races. It's possible, and common, to build safe abstractions atop a small amount of unsafe code. Even a kernel for an embedded OS can have only a small amount of unsafe code (https://news.ycombinator.com/item?id=48071117). A software stack written in Rust down to the bottom would have much less unsafe code than our current stacks.1/?
(DIR) Post #B6NPa9AlOOQXZJOlSi by matt@toot.cafe
0 likes, 0 repeats
Also on the positive side, the fact that Rust doesn't bring in a garbage collector or other heavy runtime means that Rust is on par with C and C++ in terms of being a good choice for writing libraries that can be embedded in projects written in other languages that do have their own runtime. That made Rust a good choice for AccessKit, the GUI accessibility library project that I started, though my goals for the project extended beyond Rust GUIs specifically.2/?
(DIR) Post #B6NPa9NWcwdSCtMxM0 by matt@toot.cafe
0 likes, 0 repeats
But, the Rust compiler is well-known for requiring significant computing power and memory. As just one recent anecdote, the prolific Hacker News commenter Thomas Ptacek recently mentioned that waiting for a Rust compile to finish was a factor in him deciding to comment on a controversial thread. And he was presumably running the Rust compiler on a high-end computer, the kind that we well-off software developers tend to use.3/?
(DIR) Post #B6NPa9d7gx70zGfPfM by matt@toot.cafe
0 likes, 0 repeats
I don't feel good about using, promoting, or contributing to the network effect of a language that is only practically available to well-off software developers. But at the same time, I don't want to write and encourage others to write more code that's prone to the kinds of bugs that are common in C and C++. I want safety, for applications and also system software if possible, to be available in a language that people without high-end computers can practically use.4/?
(DIR) Post #B6NPa9t4jds9mk89Wy by matt@toot.cafe
0 likes, 0 repeats
The most underpowered computer that can practically run rustc at all is a supercomputer by historical standards. Many such computers are now discarded as e-waste. I want such computers to be usable, including for developing their own software. Rust can produce very efficient, fast-starting, lean applications that can run very well on these computers. But that software can't be _developed_ on these computers, thus reinforcing the divide between user and developer.5/?
(DIR) Post #B6NPaA7brbUyVovlBY by matt@toot.cafe
0 likes, 0 repeats
I also want new personal computers to be developed that take advantage of the very low power consumption of application processors that are designed for industrial embedded applications, to do things that we currently consider impractical, like a laptop that can run for a full day on a small (e.g. 2000 mAh) battery. A laptop that can run directly off a solar panel would be even better; we've had solar-powered pocket calculators for decades, after all.6/?
(DIR) Post #B6NPaALn0sqDDnZ5Hs by matt@toot.cafe
0 likes, 0 repeats
As an example of the kind of processor I'm thinking of, consider the Microchip (formerly Atmel) SAMA5 family. Single-core Cortex-A5 at 500 MHz, benchmarking at 722 DMIPS on the evaluation board I recently ordered (yes, I've gone far down this rabbit hole), with 128 or 256 MB of RAM in typical configurations. The practicality of achieving 15 hours of battery life on a 2000 mAh battery has been directly validated by this SoC family's use in the HumanWare Mantis Q40 Braille display/note-taker.7/?
(DIR) Post #B6NPaAag7WkbxyWyUi by matt@toot.cafe
0 likes, 0 repeats
That Mantis is running a closed software stack on a SAMA5D3 SoC. It primarily acts as a Braille terminal for a PC or mainstream mobile device, and also has a handful of other applications, including a book reader that can download books over WiFi. But it could *be* a personal computer all by itself; it's already running Linux. Yes, it would be a personal computer with CPU performance somewhere in the neighborhood of a Pentium II. But we used to do real personal computing on those.8/?
(DIR) Post #B6NPaAs34we4pqeqZM by matt@toot.cafe
0 likes, 0 repeats
Like I said, I already ordered a SAMA5 evaluation board, specifically the SAMA5D27 WLSOM1 evaluation kit, with 256 MB of RAM. I got Alpine Linux running on it. It can compile C. Slowly, yes; compiling CPython (default configuration with only base development packages) took 3.5 hours. But still, it finished, without running out of memory or thrashing endlessly. When I tried compiling a small Rust application, it took long enough just to compile the syn crate that I gave up.9/?
(DIR) Post #B6NPaB9m12p7iox0CG by matt@toot.cafe
0 likes, 0 repeats
So, we could have a general-purpose personal computer that runs for 15 hours on a 2000 mAh battery. Maybe more with TTS output rather than a Braille display; I gather that Braille displays are fairly power-hungry because of all the pins moving up and down. But I believe that a general-purpose personal computer needs to be good for modifying its own software, at all levels of the stack. Rust fails hard on that criterion on this low-power CPU that has performance that used to be good.10/?
(DIR) Post #B6NPaBPN53IgVCFSVc by matt@toot.cafe
0 likes, 0 repeats
So, do I want to go back to writing, and encouraging others to write, software in C? Absolutely not. I'm convinced by the arguments that memory safety by default, that can be checked by machine rather than requiring constant programmer discipline, is a moral imperative, considering the consequences of memory safety vulnerabilities for security and privacy.11/?
(DIR) Post #B6NPaBfg6QLPJlsTvU by matt@toot.cafe
0 likes, 0 repeats
So do we have to accept that some level of computing power well above that of a Pentium II is simply the baseline for a modern general-purpose computer? Maybe. Perhaps the idea of something like the Mantis Braille display, with its battery efficiency, being a general-purpose personal computer is simply an impossible dream that I have to let go of. But, that was always an extreme example anyway.12/?
(DIR) Post #B6NPaBs5MIGjwFgOGW by matt@toot.cafe
0 likes, 0 repeats
Were there other paths to a software stack with minimal unsafe code at the bottom that required far fewer machine resources to compile, that the industry chose not to take? Maybe the Rust Graydon wanted that had no future (https://graydon2.dreamwidth.org/307291.html)? I guess it's kind of moot, because the industry didn't take one of those paths, meaning there's no big library ecosystem on which to build, say, a new personal computing platform with a TTS/Braille-first UI framework.13/?
(DIR) Post #B6NPaC6cUFtYfKTzv6 by matt@toot.cafe
0 likes, 0 repeats
OK, I guess Rust compile time isn't so bad on older computers that people actually use as personal computers. See this reply that came in from Bluesky. https://bsky.app/profile/did:plc:54jgbo4psy24qu2bk4njtpc4/post/3mlptu6oycc2g 5 seconds for a debug build on a 2009 MacBook. I feel better now.14/?
(DIR) Post #B6NPaCKReqxDMCx2TA by matt@toot.cafe
0 likes, 0 repeats
Still, I can't help but wonder. Consider a counterfactual where the original ARM processor, the one that famously ran on about 100 mW (meaning that it could, by accident, run only on leakage current), had shipped in a personal computer that had been wildly successful, and it then became an industry norm that all personal computers going forward simply must use that little power. Where would we be now? Still writing large amounts of unsafe C code? Or would we have found a different path?15/?
(DIR) Post #B6NPaCXuqljI1zFnSy by matt@toot.cafe
1 likes, 1 repeats
On further reflection, it seems to me that what really makes Rust's compile times such a problem is that the norm for Rust projects, at least those using Cargo (which I think is practically all of them), is to compile all transitive dependencies from scratch for every project. What if we got our Rust dependencies as precompiled libraries (even static libraries) from distro package managers? I guess that would require a different build system than Cargo, though.
(DIR) Post #B6NPf5Rgg1mhSPfbKC by jscholes@dragonscave.space
0 likes, 0 repeats
@matt Why distro package managers and not, say, a Cargo-compatible precompiled library format like Python's wheels?
(DIR) Post #B6NPf5fVqcqM9I8dsG by equinox@chaos.social
0 likes, 1 repeats
@jscholes @matt because Rust does not exist in a vacuum, will in some cases have C, Python, Go, Zig or whatever else dependencies, and then your choice is either 7 conflicting language package managers or 1 distro package manager.