News for hackers. Stuff that matters.
Re:Bare-metal Rust in Android by jeroenhd on Monday October 09, 2023 @05:19PM (#37825642)
There's a reason Chrome is mostly written in C++. Android's JVM system is a collection of Java wrappers around C++ libraries. There's some overhead in that translation layer, and it's unfortunate that you can't skip it. Even Google's own Flutter uses a C++ engine to run Dart applications.

Kotlin (and Java) is fast enough for many applications, but even with the recent advancements in ART, does have overhead compared to pure native code. I can't think of a reason why the API interaction overhead would pose a problem, but if Google themselves can find use cases for almost JVM-less apps, I'm sure there are reasons to give a Rust version a try.

Re:Bare-metal Rust in Android by izacus on Monday October 09, 2023 @06:11PM (#37826106)
> Android's JVM system is a collection of Java wrappers around C++ libraries.

This isn't even remotely true and it's obvious if you'd ever looked closely at Android. This take is as bizarre as saying that whole web/JS/React ecosystem is "just" wrappers on top of Skia.

Re:Bare-metal Rust in Android by rohandhruva on Monday October 09, 2023 @08:13PM (#37827065)
> There's a reason Chrome is mostly written in C++.

And for that same reason, you don't see many apps do the same thing. Any time Chrome needs to request a permission (access files, location, etc), it _has_ to use the system-provided Java APIs.

> Even Google's own Flutter uses a C++ engine to run Dart applications.

As do most games, so you can essentially think of Flutter as a game engine that renders apps.

> Android's JVM system is a collection of Java wrappers around C++ libraries.

As others have mentioned, this is very much not the case.

Re:Bare-metal Rust in Android by ireallywantthat on Tuesday October 10, 2023 @03:31AM (#37829426)
> it _has_ to use the system-provided Java APIs.

My original comment was against this. Why should this be the case?

Re:Bare-metal Rust in Android by diogenes4 on Monday October 09, 2023 @11:01PM (#37828079)
> There's a reason Chrome is mostly written in C++

Yea, security is not a concern. Apparently.

Re:Bare-metal Rust in Android by tempaccount420 on Tuesday October 10, 2023 @07:24AM (#37830746)
They didn't have Rust around when they started.
Re:Bare-metal Rust in Android by diogenes4 on Tuesday October 10, 2023 @02:42PM (#37835821)
That doesn't change anything. Security was simply never what chrome (or webkit to be fair) was built around compared to speed of the insanely inefficient browser stack.
Re:Bare-metal Rust in Android by kaba0 on Tuesday October 10, 2023 @05:30AM (#37830054)
At the same time, GUIs really don’t work nicely/as idiomatically without a GC. Most Rust GUIs do immediate mode only, which is a much more easier problem, and you won’t have to “argue” with the borrow checker constantly. But it would drain the battery of a phone in an hour (it would be the equivalent of running a proper 3D game as your notes app or whatever).