News for hackers. Stuff that matters.
Re:Velox: An open-source unified execution engine by 62951413 on Thursday September 01, 2022 @12:02PM (#32678386)
The JVM trades memory for all kinds of optimizations so it's less about raw performance and more about memory allocation tricks (and related FFI issues). This is where golang at the moment has an edge over it. Assuming you can tolerate its primitive abstractions.

Once Loom&Co get merged, the JVM is going to be unrecognizable. It's also very possible that one of those Kotlin-native/GraalVM AOT projects goes mainstream. But right now it's a problem for high-performance systems.

Personally I regret this trend because Java/Golang are much easier for people like me than C++/Rust. I cannot imagine myself going back to manually managing memory. Browsing Big Data open source code will not be as educational anymore.

Re:Velox: An open-source unified execution engine by peaky_blinder on Thursday September 01, 2022 @12:21PM (#32678706)
You don't do manual memory management in Rust either. AFAIK (correct me if I'm wrong), even in C++ manual memory management is discouraged in favor of RAII.
Re:Velox: An open-source unified execution engine by pjmlp on Thursday September 01, 2022 @01:05PM (#32679494)
You surely do, first of all the borrow checker is only a compiler validation that you are writing the manual code correctly, and no one is magically writing Drop traits implementations for the user.

Likewise on the C++ side, someone has to write those constructor/destructor pairs, and there are ways to get RAII wrong.

Re:Velox: An open-source unified execution engine by cmrdporcupine on Thursday September 01, 2022 @03:13PM (#32681550)
Seriously, no, re: Rust.

Yes, you have to think about ownership. Because of single owner. But in general, not alloc/free. I work in Rust (after doing C++ for the 10ish years prior) full time and a couple nights ago was honestly the first time I had to really think about this (I had to do a 'forget' because I was passing a ptr to a vector back through from WebAssembly to our Rust-based runtime, and then clean it up back there instead of having Rust let it fall out of scope and free when the stack frame exited).

Think of Rust as a world where pretty much everything is inside a std::unique_ptr.

Most developers used to a GC language will have little problem working in Rust once they understand the single ownership model.

Re:Velox: An open-source unified execution engine by pjmlp on Thursday September 01, 2022 @03:40PM (#32681927)
Try to write a native GUI application in Rust, or async code, and you will see how little you have to think about it.
Re:Velox: An open-source unified execution engine by cmrdporcupine on Thursday September 01, 2022 @03:48PM (#32682052)
Yes, GUI work is a pain because of the way event loops and ownership in existing UI toolkits work, they're generally not designed for this. But Arc<Mutex< is likely your friend here.

Async can be a pain, but you learn the ways. I work in a codebase with quite a bit of it.

There are appropriate and inappropriate places to apply Rust.

Re:Velox: An open-source unified execution engine by pjmlp on Thursday September 01, 2022 @05:27PM (#32683490)
It surely is my friend, and I will need to manually call clone() and borrow().
Re:Velox: An open-source unified execution engine by hobofan on Thursday September 01, 2022 @02:33PM (#32680924)
> no one is magically writing Drop traits implementations for the user.

Yes, the compiler is - for almost all structs. I've been working with Rust since around 1.0 and I can count the number of times I manually had to write Drop implementations with my hands. Unless you are writing lower-level parts of the stack (which you rarely need to, since for many of those there are good crates already available) where you are responsible for resources that need a custom Drop implementation, the auto Drop implementation is good enough.

Re:Velox: An open-source unified execution engine by pjmlp on Thursday September 01, 2022 @03:07PM (#32681454)
Trivial types don't count, their Drop implementation is basically do nothing.

And for Rust standard library, where the Drop actually does something, someone else wrote the implementation for you.