Omae wa mou shindeiru
Yoko, Shinobu ni, eto… 🤔
עַם יִשְׂרָאֵל חַי Slava Ukraini 🇺🇦 ❤️ 🇮🇱
Omae wa mou shindeiru
Yeah it’s not Linux. It’s forked off MenuetOS (https://menuetos.net/ ) which is a hobby OS written entirely in assembly (FASM flavor, https://flatassembler.net/ ).
The reason I said to use rvalue references is because otherwise it is an apples-to-oranges comparison: in the C++ code you have implicit ABI decisions around the call convention and whose responsibility it is to destroy the temporary.
Yes, sure, compiling in one translation unit helps, but as I mentioned above, passing an owning pointer between translation units shouldn’t be inherently inefficient
https://godbolt.org/z/9875qMM6Y (or alternatively: https://godbolt.org/z/9xehs3sYP)
The assembly is identical, the ownership is clearly transferred, and this doesn’t need LTO or looking at the function bodies and is entirely done by the C++ compiler. It involves using (when available) a vendor attribute (see trivial_abi, shouldn’t be an issue given Rust devs are fine with having only one compiler anyway) and writing a UniquePtr
class (shouldn’t be used in production code, what I’ve given there is only for illustration purposes) that assumes that the custom deleter cannot have an internal state.
This is a zero-runtime-cost abstraction. Now whether the zeroing of that cost can depend on what ABI assumptions you’re ready to make, or whether you want to depend on LTO is another thing. We’re literally discussing a “problem” that is not really a problem because Rust doesn’t have the luxury yet to have that problem: you’re easily forgetting that Rust has only one compiler.
Carbon was announced in 2022
A project like that usually takes years, so again, very likely that they began working on it years before that. For instance, Google designed Go in 2007 and announced it in November 2009.
It’s actually a good thing that visual learners get a chance to learn useful stuff by watching videos. Not everyone has the attention span required to read through a Wikipedia page.
And you can’t really get a lot of words from “I waited 8 hours for Firefox to build.”
You actually can if you describe the build process and how emerge works, how you can customize the packages with Gentoo’s USE flags etc…
It’s probably part of some homework and he has to describe the install process? Could have picked Gentoo for a higher word count IMO
Since you already know Java, you could jump straight to C++ with Bjarne’s book “Programming - Principles and Practice Using C++”: https://www.stroustrup.com/programming.html
You can then move to more modern C++ with his other book “A Tour of C++”: https://www.stroustrup.com/tour3.html
And then if you’re curious to know how software design is done in modern C++, even if you already know classical design patterns from your Java experience, you should get Klaus Iglberger’s book: https://www.oreilly.com/library/view/c-software-design/9781098113155/
In parallel also watch the “Back to Basics” video series by CppCon (see their YouTube channel: https://www.youtube.com/@CppCon , just type “back to basics” in that channel’s search bar).
Learning proper C++ should give you a much better understanding of the hardware while the syntax still remains elegant, and you get to add a new skill that’s in very high demand.
Just curious, what other languages have had “one dopey teenager” of their community go and deface cppreference.com ? (which by the way happened multiple times with Rust kiddies, not just 4 months ago)
That’s a bad apples-to-oranges comparison, unique_ptr
frees memory upon destruction, which with the raw pointer version you don’t do. The least you could do is use rvalue references. The class layout of unique_ptr
is also hard to optimize away (unless via LTO) because consume
isn’t in the same translation unit and the compiler has to let your binary be ABI compatible with the rest of your binaries. (Also, you’re using Clang 9 by the way, we are at version 17 now)
This is much fairer: https://godbolt.org/z/v4PYcd8hf
Then, if you additionally make the functions’ bodies accessible to the compiler and add a free
to the raw pointer version (for fairness if you insist to have consume
or foo
destroy the resource), you should get an almost identical assembly code (with still an extra indirection that you’ll see in an extra mov
due to the fact that the C++ compiler still doesn’t see how you use them, but IMO that should still be a textbook case for LTO), and the non-zero difference should disappear altogether once you actually use those functions and if it doesn’t you absolutely should file a bug report.
Carruth, while an excellent presenter, has been on a “C++ standard committee bad, why don’t we do more ABI-breaking changes, y’all suck, Abseil and Carbon rule” rant spree, with that basically materialized by Google stopping active participation in Clang (haven’t followed the drama since then so not sure if Google backtracked on that decision), and it’s hard to consider him to be objective about this since he also has the Carbon project and his recent Carbon talks are painful to watch as it’s hard to ignore how he’s going from a “C++ optimization chad” that he used to be to a Google marketing/sales person.
Rust developers are already known (/memed) to be elitist about Rust
They’re also extremely toxic. An example from 4 months ago when they vandalized cppreference.com :
The meme is that most Rust devs merely shout slogans like “memory-safety” without knowing what they mean, precisely because many of them come from web dev backgrounds (this video by Prime Time proves why that’s problematic: https://www.youtube.com/watch?v=Wz0H8HFkI9U , the guy has no clue what std::unique_ptr
is) and have never touched a pointer in their lives. Easy and “appealing to hobbyists” languages are always an issue as the community usually ends up becoming toxic and full of wrong practices being normalized, and a prime example of that is PHP.
Another example is how Lemmy initially struggled to handle 10k~20k users during the Reddit exodus despite the backend being written in the “ultra-fast memory-safe totally-will-replace-C++” Rust. Why? See this: https://github.com/LemmyNet/lemmy/issues/2877 and they were doing stuff like joining huge-ass tables before the filtering. If phiresky didn’t save them with his SQL prowess Lemmy would have literally died and its backend being written in Rust would not have changed a single thing.
Rust gives hobbyists the illusion that their projects will suddenly become fast and bug-free if they write them in Rust, and they don’t even hide that mentality as you can see that on almost every single project that’s written in Rust they list “written in Rust” as the main selling argument. This is probably the only language I’ve seen where this happens.
Now as for the “Java bad”, I’m kind of guilty of it too. I very much dislike how academia is obsessed with UML diagrams and the “Java way” of seeing OOP and interfaces everywhere. CPUs and GPUs do not think in OOP. They do not see “objects”. They see data, registers, caches, branches but certainly not your “beautiful abstract class”. When you think you did a good job of crafting a “clean” UML diagram with lots of “nice interfaces” which you then implement using virtual polymorphism in C++ and abuse dynamic_cast
, you’re torturing the CPU with indirections, cache misses and branch mispredictions. Dynamic polymorphism and virtual inheritance in particular should not be the standard way to solve problems, yet that’s exactly what academia teaches and most of those who push those ideas coincidentally also happen to be from Java backgrounds and that’s why the “Java bad” meme is still alive.
That said, beyond academia, I think it’s obviously stupid to religiously shit on Java. Lot’s of advanced features are coming out, Android is a thing thanks to Java and lots of web services are working with high reliability thanks to it. Also obviously, one has a much better chance at landing a high-paid software engineering job if one knows Java than if one knew only Rust.
If you’re doing C++ then C++ Weekly by Jason Turner is an awesome must-watch.
For anyone wondering what Proton GE is, it’s Proton on steroids: https://github.com/GloriousEggroll/proton-ge-custom
For instance, even if you have an old Intel integrated GPU, chances are you can still benefit from AMD’s FSR just by pushing a few flags to Proton GE, even if the game doesn’t officially support it, and you’ll literally get a free FPS boost (tested it for fun and can confirm on an Intel UHD Graphics 620).
I absolutely love his talks (especially the one on local allocators), I’ll give his book a try!
Congrats! Your laptop will be even happier with a lighter but still nice-looking desktop environment like Xfce and you even have an Ubuntu flavor around it: Xubuntu.
reminds me of instead of
#if !defined(...)
My bad, I’ll move there then
Hard to tell as it’s really dependent on your use. I’m mostly writing my own kernels (so, as if you’re doing CUDA basically), and doing “scientific ML” (SciML) stuff that doesn’t need anything beyond doing backprop on stuff with matrix multiplications and elementwise nonlinearities and some convolutions, and so far everything works. If you want some specific simple examples from computer vision: ResNet18 and VGG19 work fine.
Works out of the box on my laptop (the export
below is to force ROCm to accept my APU since it’s not officially supported yet, but the 7900XTX should have official support):
Last year only compiling and running your own kernels with hipcc
worked on this same laptop, the AMD devs are really doing god’s work here.
Yup, it’s definitely about the “open-source” part. That’s in contrast with Nvidia’s ecosystem: CUDA and the drivers are proprietary, and the drivers’ EULA prohibit you from using your gaming GPU for datacenter uses.
for the math homies, you could say that NaN is an absorbing element