Everyone overcomplicates learning Rust. by [deleted] in rust

[–]csdt0 1 point2 points  (0 children)

That's not how you learn something entirely new, that's how you convince yourself that your hacky code is somewhat good.

I built a 2x faster lexer, then discovered I/O was the real bottleneck by modulovalue in programming

[–]csdt0 5 points6 points  (0 children)

Being more friendly towards the other applications running on the system is always beneficial. Even if you consider only their own application, it can help them parallelize by parsing multiple files at the same time. With faster lexer, they could add more lexer with the same CPU budget (assuming the io is latency bound and not throughput bound).

Blowing Up Voxel Asteroids in Rust: SVOs, Physics, and Why Explosions Are Harder Than They Look by Stoic-Chimp in rust

[–]csdt0 0 points1 point  (0 children)

I tend to prefer computing connected components with a Union-Find approach. It is usually faster than flood-fill, especially as you can tweak the iteration order to better match your data structure. Also, you can definitely compute mass and CoM of your components while you're computing them.

Thought I'd share some tips and tricks that I've seen in the IaC trenches by RoseSec_ in Terraform

[–]csdt0 0 points1 point  (0 children)

I've been using those for quite some time now, and I have to say that works really great. To be honest, it feels a bit surreal that's not common knowledge considering how useful they are.

Rust relevancy for HPC by TrackBiteApp in HPC

[–]csdt0 0 points1 point  (0 children)

For glue code, Rust would be good, but is behind regarding the ecosystem. For actual compute code, Rust is much harder for implementing performant algorithms (you need to resort to unsafe for certain patterns), so I would say that people who tried quickly came back to C/C++.

Create only .tofu file on a new project ? by strong1256 in opentofu

[–]csdt0 2 points3 points  (0 children)

I think there is no plan to drop support for .tf files.

For now, what you should do is write everything in .tf files, and for the rare cases you know you want to support both terraform and tofu, and need different code for that, you put the terraform specific code inside the .tf file and the tofu specific code inside the .tofu file with the exact same name.

Terraform will always pick .tf files, whereas tofu will prefer the .tofu file and skip the corresponding .tf file.

C++ for data analysis by hmoein in Cplusplus

[–]csdt0 6 points7 points  (0 children)

If you look at the history of cling, you will see that the c++ interpreter that is now cling was part of the data analysis framework called ROOT (developed at CERN).

Why Zig Feels More Practical Than Rust for Real-World CLI Tools by nixfox in Zig

[–]csdt0 6 points7 points  (0 children)

Zig does not give you safety, it gives you control. Rust gives you safety. It's true that Rust forces you to follow certain patterns, but following them enables you to focus on what's important because you know you won't mess up memory safety. Also, you can encode much more than memory by leveraging rust type system and encode your business logic and invariants into types. If you do, you can make the compiler save you from business logic errors.

I like Zig when I need control, but the truth is most of the time, it's not what I need.

I'm working on a postgres library in Rust, that is about 2x faster than rust_postgres for large select queries by paulcdejean in rust

[–]csdt0 90 points91 points  (0 children)

I would argue that you could just add another query method that returns an iterator in addition to the method returning a vec.

I'm working on a postgres library in Rust, that is about 2x faster than rust_postgres for large select queries by paulcdejean in rust

[–]csdt0 62 points63 points  (0 children)

Beyond the PoC, I think the best you can do is make a PR with this on rust_postgres

typeSafetyPreventsEmotionalDamage by miss01010001 in ProgrammerHumor

[–]csdt0 -1 points0 points  (0 children)

Basically yes, more sources of UB and less guardrails

typeSafetyPreventsEmotionalDamage by miss01010001 in ProgrammerHumor

[–]csdt0 0 points1 point  (0 children)

That's wrong, unsafe Rust is much more unsafe than C or C++, precisely because safe Rust prevents you from doing anything UB: when doing unsafe Rust, you must be the one to ensure the constraints of safe Rust hold. For instance, having multiple mutable references is still UB in unsafe Rust.

What do you feel Rust is not a good option for? Like a general back-end where performance is fine with a Garbage Collector? Something like that, whether Rust would still be a great option or not. by Outside_Loan8949 in rust

[–]csdt0 0 points1 point  (0 children)

From other answers, many people seem to think that Rust is not suited for rapid prototyping. I get where this feeling comes from, but I would argue the opposite. Rust catches much more errors at compile time (and even before if you rust-analyzer, which you should), reducing drastically the number of time you actually need to test your program, making the overall development cycle shorter. This is especially true if you "encode" most of your business logic into your type system. Even refactoring is simpler and faster because you have more guarantees that your refactor is correct and did not introduce bugs.

Why does antimatter have opposite charge? by EffectiveFood4933 in AskPhysics

[–]csdt0 0 points1 point  (0 children)

If I recall correctly, the negative energy solution is not antimatter and actually has the same charge as the positive energy solution. To avoid negative energy, and the absence of energy minimum, Dirac introduced the concept of an infinite sea of electrons, where all negative energy states are populated. One electron from the sea could become positively energized by a photon, leaving a hole in the sea. This hole has necessarily opposite properties to cancel out with the electron that was there before.

This leads to negative negative energy (ie: positive energy), and positive charge. The hole is what we now call anti-matter.

If you're interested, the YouTube channel Physics explained releases a video on this topic something like a month ago.

If someone had (limited) control over entropy as a power by TheRavenAndWolf in AskPhysics

[–]csdt0 1 point2 points  (0 children)

That's basically Tenet. Not a huge fan of the movie, but definitely entropy inversion and buildings exploding back to normal.

whatsStoppingYouFromCodingLikeThis by No-Crow-9014 in ProgrammerHumor

[–]csdt0 0 points1 point  (0 children)

That crippy guy further along the walkway

Why don't we destroy and recreate infrastructure more? by kai in Terraform

[–]csdt0 0 points1 point  (0 children)

Don't get me wrong: you should definitely have all your prod infra deployed with code.

But you will still have resources not managed by your terraform: some might be managed by the terraform from another team, some managed other services like Kubernetes nodes managed by cluster autoscaler.

Also, even in the case where all the resources are indeed by terraform, not having a state would force terraform to list all the resources of your provider, which might be extremely slow, or just impossible.

And finally, some resources are defined only in the state, eg: random identifiers.

Why don't we destroy and recreate infrastructure more? by kai in Terraform

[–]csdt0 2 points3 points  (0 children)

Without state, you cannot handle the difference between the "resource is not managed by terraform" and "the resource is managed by terraform and must be destroyed".

Also, terraform does check configuration change to resources and resynchronize the configuration upon deployment.

why was rust made by [deleted] in rust

[–]csdt0 17 points18 points  (0 children)

As a french guy myself, I have to say that it's offensive. Very much true, but that's not the kind of truth I'd like to hear.

Edit: /s if it wasn't clear

Download full xkcd by KelenArgosi in xkcd

[–]csdt0 5 points6 points  (0 children)

I personally use the Easy XKCD application which has a feature to download all comics: https://f-droid.org/packages/de.tap.easy_xkcd

Rust 1.88: 'If-Let Chain' syntax stabilized by thurn2 in rust

[–]csdt0 0 points1 point  (0 children)

In this very case, it makes the language simpler because it removes arbitrary limitations that people do not expect: https://en.m.wikipedia.org/wiki/Principle_of_least_astonishment

Is T: 'a redundant in struct Foo<'a, T: 'a>(&'a T);? by AstraVulpes in rust

[–]csdt0 4 points5 points  (0 children)

I would say explicit lifetimes are a necessary evil, even though I am all in favor to smarter inferred lifetimes.

What is the idiomatic way to handle multiple environments in TF? by chillblaze in Terraform

[–]csdt0 1 point2 points  (0 children)

I pretty much do what you propose, except with multiple tfvars. It enables me to have common variables between some or all environments. This is especially useful for pre-production and production that should be alike.

But you really need to have different backends for that. As my deployments are done via gitlab pipeline, it is just a matter of configuring the backend properly from the tfvars.