BB_C

joined 1 year ago
[–] BB_C@programming.dev 1 points 2 days ago (1 children)

naysayer

πŸ™‚

[–] BB_C@programming.dev 1 points 2 days ago

for multi threaded workloads there aren’t many options

Anyone who actually writes Rust code knows about tracing my friend.

We also have the ever useful #[track_caller]/Location::caller().

And it's needless to say that dbg!() also exists, which is better than manual printing for quick debugging.

So there exists a range of options setting between simple printing, and having to resort to using gdb/lldb (possibly with rr).

But yes, skipping debugging symbols was a bad suggestion.

[–] BB_C@programming.dev 2 points 3 days ago (1 children)

It’s quite simple. Just remove the permalink field! If you are calculating it then no need to store it in the struct.

This is inefficient. It should be the other way around. Remove base_url and rel_permalink, and store permalink and the rel_permalink offset.

That way, you can get a zero cost &str for any of the three.

[–] BB_C@programming.dev 7 points 3 days ago (3 children)

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.

[–] BB_C@programming.dev 2 points 5 days ago (1 children)

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.

[–] BB_C@programming.dev 4 points 1 week ago (1 children)

You appear to be generally confused.

If you're using the multi-threaded work-stealing tokio runtime (the default), you are "talking threads". And if you aren't, Arc and Mutex would be useless, irregardless of whether you're doing it right or wrong.

[–] BB_C@programming.dev 2 points 1 week ago

This is neither news*, nor majorly relevant. Having rustc_codegen_gcc as a rustup component is going to be way more relevant, and is much closer to delivery, just to give an example.

* The post itself (not the content of it) appearing on the official blog was sort of pleasantly surprising (brought tears to my eyes, i tell ya). Hopefully that was a result of maturity, rather than external pressure.

[–] BB_C@programming.dev 0 points 2 weeks ago (1 children)

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?

[–] BB_C@programming.dev 3 points 3 weeks ago* (last edited 3 weeks ago) (1 children)

&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 πŸ˜‰

[–] BB_C@programming.dev 2 points 3 weeks ago (3 children)

Cow does not work when you are actually required to return a reference

What does that even mean? Can you provide a practical example?

(I'm assuming you're familiar with Deref and autoref/autoderef behaviors in Rust.)

[–] BB_C@programming.dev 7 points 3 weeks ago (2 children)

Is what the author calls a C# borrow checker purely lexically based? The first error message gives that impression. And if it is, then it wouldn't qualify for any such comparisons with 2018+ Rust.

[–] BB_C@programming.dev 4 points 3 weeks ago (9 children)
  1. Unconvincing use-case: why is returning an Option not an option?
  2. Unconvincing objection: what concrete problems are caused by utilizing Cows?
  3. Wrong demonstrated "solution": why would one have to create a value and leak it with each call instead of using one LazyLock static?
view more: next β€Ί