u/Badel2

2,810 post karma · 15.1k comment karma · joined Jun 2014 · moderator

Badel2

Also keep in mind that C is old, and some advice that was valid 30 years ago is no longer relevant.

I don't have any resources on C but some of the C++ core guidelines apply, so take a look at that.

Badel2

Isn't it more likely though?

Without vsync the gpu will be rendering frames 100% of the time. Consider a monitor running at 1hz. What's the probability to get tearing there? Now consider a monitor running at 1000hz. What's the probability to get tearing there?

Maybe you're saying that at 1000hz you won't see the tearing because it will only be there for 1 frame, but I don't think that's a good argument because tearing will still happen.

Badel2
Badel2

Without benchmarks this is pointless, are you parsing files in the GBs in size and that's why memory is a concern? Because if not this is just premature optimization: it makes the code harder to maintain, and there's a possibility that you actually made it run slower.

Badel2

In other words, it's cheaper than your phone?

Badel2

Yes you are right, the problem is lack of maintainers. The people who can decide the future of the language can't keep up with all the suggestions and they only focus on important stuff and minor improvements that are easy to review.

Badel2
Badel2

Yes, the "not running" is supposed to be a progress bar but it's not implemented yet. For now you can see some progress logs on the developer console, and if there's any errors you will also see them there.

Badel2

In the read_png function, you can use std::fs::read to read a file into a Vec<u8>. Also you could provide another function that allows to read a png directly from a &[u8], which will let the caller handle the file reading.

Badel2

Assuming one 5 second ad per video, it will only take you 120 videos to break even :)

Badel2

No idea

Badel2

I? Wait you linked to your own post? Mods!

Badel2

I'm afraid you will have to fork all dependencies and manually edit their Cargo.toml.

Badel2

Thanks, now OP will know to remove this hash before sharing the pdfs

Badel2

We did it reddit!

Badel2

Exactly, this is a language problem, we shouldn't have each crate trying to optimize it using hacky workarounds. I believe there already exists an alternative to cargo install that downloads prebuild binaries, so users with performance concerns can use that.

Badel2

Makes sense. Then I don't think this is a good idea.

Badel2

A simple solution would be to have users compile this binary on their first cargo build, then no binaries are distributed and the alleged performance wins aren't lost. I guess it would have to be compiled once per project, unless cargo offers some feature to store artifacts in ~/.cargo, but then it would need to be versioned so simply having one binary per project sounds like a good first step.

Badel2

No plans for that currently, because reading the world files is much faster and easier than generating the caves. Any reason why you can't use a world download?

Badel2

Basically if that compiled, then I could write the same function using Rc<RefCell>, because Rc is covariant, and that would allow me to write a shorter lifetime, while an Rc with the long lifetime is still alive and can read it, resulting in undefined behavior.

Badel2

Search for "capture the flag", or CTF challenges, it's usually simple programs with intentionally included vulnerabilities.

Badel2

This doesn't work if it's an array of floats, because infinity and NaN cannot be converted to JSON.

Badel2

Great post. I remember the pain that was to add const fns and stabilize hundreds of methods, it seems that an effect system like this would take even more effort for a niche benefit. I wonder if there's a solution to that, the keyword generics proposal comes to mind. We could automatically mark all the const fn functions from the standard library as terminating, but other effects would need manual review.

Badel2

fuck u/spez -- mass edited with redact.dev

Badel2

The Russian currency has never recovered and its currently near to its all time low. That "recovery" you heard about was Russian propaganda because they made selling their currency illegal, and that made its price to go up. But that artificial increase in price had nothing to do with the real value of the currency, as seen by the latest events.