• 4 Posts
  • 204 Comments
Joined 1 year ago
cake
Cake day: July 6th, 2023

help-circle


  • With all the respect to the author and his wild experiments, that title does not match the linker-only focus of the content.

    So not only the post ended up with two (IMHO) bad recommendations (disabling debug info, building non-relocatable binaries with musl). But it also didn’t mention other important factors like codegen-unitsand codegen-backend. Since you know, code generation is the other big contributor to the cycle time (the primary contributor even, in many cases). There is also other relevant options like lto and opt-level.

    Let’s assume that opt-level shouldn’t be changed from defaults for no good reason.

    With codegen-units, it’s not the default that is the problem, but the fact that some projects set it to 1 (for performance optimization reasons), but without adding a separate profile for development release builds (let’s call it release-dev).

    Same goes for lto, where you can have it set to "full" in your optimized profile, and completely "off" in release-dev.

    And finally, with codegen-backend, you can enjoy what is probably the biggest speed up in the cycle by using cranelift in your release-dev profile.

    And of course you are not limited to just two release profiles. I usually use 3-4 myself. Profile inheritance makes this easy.

    And finally, you can set/not set some of those selectively for your dependencies. For example, not using cranelift for dependencies can render the runtime performance delta negligible in some projects.


    Using the parallel rustc front-end might become an interesting option too, but it’s not ready yet.


  • Another meme answer: nu.

    I never actually used nu for anything. But I’ve been thinking (unironically) that nu with its built-in from_json and to_json can be interesting.

    The use-case I had in mind is not games or anything like that, but some system or dev tools that traditionally utilized shell scripts, but are moving towards better languages like python. So I thought a single binary that embeds nu, but also has a lot of sub-commands that implement a lot of sub-tasks in Rust directly, and with JSON used as an exchange format, the combination can be interesting.

    Now that I think about it more, this can work in both directions, with main execution being in nu (what I had in mind), or in Rust.

    nu even has an lsp server, so the development experience should theoretically be good.



  • Use libcosmic 😑

    No, but seriously… skip to the end.

    Iced and Egui both can’t handle Arabic, which is a deal breaker.

    Iced can handle Arabic shaping-wise when cosmic-text is used, but it can’t handle the direction (yet). If you only need it for the interface, a shit workaround would be to prefix all text with an RLM (RIGHT-TO-LEFT Mark). This would left-align all text of course.

    Iced takes forever to compile and iterate, maybe that’ll be fixed with dynamic linking.

    Fast iteration is already fixed by using cranelift in your release-dev profile (or whatever you want to call it), and mold as a linker. The binary will be slower, but iteration will be much much faster.


    Okay, something helpful instead: Did you try asking in the rust:gnome.org matrix room mentioned in the project page?


  • &Bar is a reference to something. That something is either a part of self, or a part of the static context. There is no other context because there is no runtime/GC. So there is no logical not-nonsensical scenario where this would be both a valid and a limiting situation in Rust. And this is why your surface analogy to Index is invalid.

    If the return value may depend on something other than self or the static context, and still need to be reference-like, then the trait definition is wrong. It should either return a Cow, or go for the obvious generalization of returning impl AsRef<Bar> values. With that generalization, references, Cows, and more can be returned.

    There is also the possibility that the trait definition is right, and you (the implementer) are trying to break a (probably) deliberate constraint (e.g. the return value in Index being tied to &self).

    I would wager a guess that what you call an escape hatchet is considered a very bad C# style anyway (or will/should be). Just like how mutable statics are considered very bad in Rust 😉






  • Sorry, I thought you meant the use of .. in Rust is odd. So I pointed out that {0..9} and{a..z}is also used at least in bash and zsh. That’s at least 10s of millions of users!

    I know of .. being used for appending by lua at least. So still not odd-ball I would argue, since the people who interacted with lua code in their life probably outnumber those who interacted with all functional languages combined.



  • Is this going to be re-posted every month?

    Anyway, I’ve come to know since then that the proposal was not a part of a damage control campaign, but rather a single person’s attempt at proposing a theoretical real solution. He misguidedly thought that there was actually an interest in some real solutions. There wasn’t, and there isn’t.

    The empire are continuing with the strategy of scamming people into believing that they will produce, at some unspecified point, complete magical mushrooms guidelines and real specified and implemented profiles.

    The proposal is destined to become perma-vaporware. The dreamy guidelines are going to be perma-WIP, the magical profiles are going to be perma-vapordocs (as in they will never actually exist, not even in theoretical form), and the bureaucracy checks will continue to be cashed.

    So not only there was no concrete strike back, it wasn’t even the empire that did it.


  • Maybe this is a reductionist simplification of it, but his point is basically that, at least in the context of rust, async code is explicit and easy to introduce in a blocking context by simply blocking on it, while blocking code is not explicit about how blocky it is (and it’s not a binary), and thus, it’s not trivial to know where explicit unblocks are needed in an async context.

    Blocking on async code is usually done with some_executor::block_on(), of which some very lightweight implementations exist, combined with the possibility of not requiring that the data’s ownership be moved to the executor, nor is the data required to be Sendable to other threads (an executor doesn’t have to be a multi-threaded work-stealing one).

    Meanwhile, unblocking is done usually via blocking::unblock() or some_executor::spawn_blocking(), and doesn’t offer such flexibility.




  • I do think it would’ve been worth it to introduce ++ for general appending.

    I already mentioned (val..).next() which is both safe* and explicit about it being a generic stepping operation instead of possibly being sugar for {x = x + 1; x}.

    Also, calling it “appending” is weird for us folks coming from languages like C 😉

    * you don’t have to worry about what i32::MAX++ would/should return.



  • Multi-threading support

    Who stopped using pthreads/windows threads for this?

    Unicode support

    Those who care use icu anyway.

    memccpy()

    First of all, 😄.
    Secondly, it’s a library feature, not a language one.
    Thirdly, it existed forever in POSIX.
    And lastly, good bait 😄.

    whats so bad about Various syntax changes improve compatibility with C++

    It’s bad because compiler implementations keep adding warnings and enabling them by default about completely valid usage that got “deprecated” or “removed” in “future versions of C” I will never use or give a fuck about. So my CI runs which all minimally have -Wall -Werror can fail with a compiler upgrade for absolutely irrelevant stuff to me. If it wasn’t for that, I wouldn’t even know about these changes’ existence, because I have zero interest in them.

    Those who like C++ should use C++ anyway. They can use the C+classes style if they like (spoiler alert: they already do).

    I can understand. But why would you not use newer C versions, if there is no compatibility with older version “required”?

    Because C doesn’t exist in a vacuum, and Rust exists. Other choices exist too for those who don’t like Rust.

    My C projects are mature and have been in production for a long time. They are mostly maintenance only, with new minor features added not so often, and only after careful consideration.


    Still interested in knowing what relevant projects will be using C23.