6 ms·
Musl: List of alternative libs that are lightweight, not bloated and efficient
- Y_Y 3y agoGreat case for an Oxford comma here
- mike_hock 3y agoNot fixing an unchecked malloc failure in an ncurses alternative gets you struck out on the list, but having unpatched vulnerabilities in a crypto library doesn't. Also, the link to uSTL is dead.
- pipeline_peak 3y agoHonestly not trying to troll, if you’re trying to avoid bloat shouldn’t you go with C instead of C++. At some point you’re going to run into virtual tables among other overhead.
- dundarious 3y agoYour general point is in agreement with the article then.
- SubjectToChange 3y agoLess "bloat" doesn't mean more performance. C++ libraries have soundly beaten their C counterparts in HPC, HFT, ML, etc. And in any case it is still possible to write a C-dialect in C++ if you so choose.
- pipeline_peak 3y agoI was referring to bloat as in memory usage. A quick glance at Moe, I see inheritance in something as fundamental as buffers.
- SubjectToChange 3y agoAgain, you can write a C89 (even more with C++20) dialect in C++. There’s practically nothing C can do that C++ can’t. Also, the fact that the linked page recommends tinycc and pcc pretty much proves they don’t care about performance or memory usage.
- mike_hock 3y agoYou run into virtual tables more often in C because you can't build an abstraction otherwise, whereas in C++ it could be inlined. Example: Callbacks in C are always virtual, whereas in C++ you can take the callback as a template parameter. Not distinguishing between "virtual" or "function pointer" or any other names for the same concept (dynamic call address).
- pipeline_peak 3y agoC has inline, are you talking about older versions?
- pjmlp 3y agoInline is an hit, doesn't mean it gets really expanded, that is why compilers have extensions for "I really mean it, inline no matter what". C++ templates provide the mechanism to really inline complex code, run it at compile time and just place the result into the binary, instead of clunky preprocessor macros.
- mike_hock 3y agoInlining a struct of callbacks is a much more brittle optimization in C than inlining calls to member functions on a class accepted as a template argument in C++, which I consider a fair comparison because the former is the closest approximation C has for the latter. You might get a failure to inline and get direct calls to fixed function addresses in the latter case, but never virtual calls (unless the member functions themselves are virtual, of course). The former case relies on the compiler seeing through the entire call chain and being able to prove that the function pointers don't change. The idea that virtual calls can bite you in C++ but not in C is clearly nonsense, as in any situation where you'd need a virtual function in C++, you'd need a function pointer in C, and virtual functions don't happen accidentally as you have to explicitly write "virtual."
- pipeline_peak 3y ago-2 votes (im sure and counting) for an honest question, this site has really turned into something else…
- SubjectToChange 3y agoWhat is the best piece of software the musl/suckless/cat-v crowd have to offer? They smugly moan about the state of modern software but only manage to write alternatives to relatively trivial programs. For instance, it's ridiculous to recommend tinycc or pcc as an alternative to GCC or Clang.
- dduong 3y agodwm is nice. I enjoyed using it for a while.
- SubjectToChange 3y agoI'll assume dwm is great and all, but I feel like that just proves my point.
- _benj 3y agomusl itself, busybox let’s you have a full unix set of tools for 700kb, which is awesome for embedded Linux. There’s also dropbear, and ssh/sshd implementation in about 110kb binary. So when talking about bloat in embedded, it something very measurable when the option is a 32MB NOR flash chip for the root file system
- deleted 3y ago[deleted]
- SpriglyElixir12 3y agoTo play the devils advocate here, aren't they basically proving you only need trivial software to get by?
- delta_p_delta_x 3y ago> you only need trivial software to get by I'd like to see the smug suckless crowd write anything resembling a modern 3D multiplayer video game today, from scratch, using OpenGL (oh, because Vulkan is 'bloat'—extremely ironic take, given Vulkan is closer to the metal than OGL), C, and their various collections of UNIXisms. I'll bet they'll just dismiss video games as 'bloat' and mindless time-wasters, and 'you shouldn't play video games, just write code.' I dislike this sort of dogmatic thinking. Use what works, use what is practical, use what is easy, use what is reasonably efficient and fast without being extremely complex. For me, oddly enough, this sits squarely in the 'sucks a lot' group of things. I write my code in VS Code and Visual Studio on Windows, using CMake. I use C++ if I need native performance; otherwise, I use C#. I use LaTeX only if I am writing a complex paper or report which needs detailed typesetting, nice graphics, long bibliographies. Otherwise, I reach for Word. I think XML is a great markup and serialisation tool, especially if one has a fully-conforming schema and code generator. JSON, YAML, TOML, etc. are all generally inferior to XML, by virtue of missing features that XML has. Proof by example: large, complex APIs (OpenGL, Vulkan, WinRT) are usually released in XML, upon which code generators may be built for different languages to generate projections in said languages. If these languages have reflection, one could even write the generators in the languages themselves.
- TechBro8615 3y agoSlightly off-topic rant about musl in the context of Alpine Docker images: It's cool that we have an alternative to glibc, and it's cool that the popularity of Alpine Docker base images has caused developers to put the effort into expanding compilation support to a wide range of binaries. But personally, I got sick of how many hours I spent debugging a seemingly endless train of binaries that would fail in strange ways when running under Alpine, or that just didn't run at all because they were compiled with glibc. So I gave up and switched to using Ubuntu as a base image and never looked back. I've never even understood the obsession with minimizing base image size, because it's not like it gets loaded into memory, and the fact that it's a base image means you share it with multiple images anyway, so you rarely even need to download or upload the layer over the network.
- nerdbaggy 3y agoI really like Alpine for making vm images. It is extremely easy to make the VM only run in memory or in data disk mode where the code is in ram but the files are persisted to disk with snapshots https://wiki.alpinelinux.org/wiki/Installation#Diskless_Mode https://wiki.alpinelinux.org/wiki/Installation#Diskless_Mode
- TechBro8615 3y agoThat sounds like an interesting use case and a valid time to be concerned with image size. It's the cargo-culting optimization of Docker base images that I'm complaining about.
- thraway23432 3y agoIt's a solved problem, use scratch, distroless, or buildpacks.
- dharmab 3y agoIf you want to minimize inage size Alpine isn't the best choice anyway. Something like Distroless is usually a better choice.
- 3y ago