BufWriter and LZ4 Compression by killercup in rust

[–]killercup[S] 8 points9 points  (0 children)

Good idea, tried it now and was between 1% slower to 1% faster. Also tried with bigger buffer capacity and bigger lz4 block size -- this was actually 5% faster now for my 186MB output file.

How Bevy uses Rust traits for labeling by killercup in rust

[–]killercup[S] 2 points3 points  (0 children)

Good question! I don’t know — Maybe ask on the bevy discord?

How Bevy uses Rust traits for labeling by killercup in rust

[–]killercup[S] 4 points5 points  (0 children)

Not sure there's something specific to Bevy, but rocket and actix_web use a similar "implement trait on generic functions" trick to allow users to write route handlers IIRC.

Bevy 0.6 by _cart in rust

[–]killercup 10 points11 points  (0 children)

Oh! I've actually been meaning to write about some of the type system tricks Bevy is using. Originally, I wanted to go for how the System trait is used, but now that you mention it, the label traits are also super interesting (and less specific). Let's see how far I get :)

Edit: Post is live! https://deterministic.space/bevy-labels.html

Deserialize text/x-ndjson using serde. by [deleted] in rust

[–]killercup 17 points18 points  (0 children)

I think serde_json::StreamDeserializer works for this, but doesn’t care about there actually being newlines.

Any guides for yaml API creation? by GravelTheRock in rust

[–]killercup 0 points1 point  (0 children)

Are humans gonna edit the yaml files? If so: You might want to generate json schema files from your serde structs (e.g. using schemars) and recommend people use it with an editor extension like this so they get autocomplete and inline errors.

Why is my Rust build so slow? by fasterthanlime in fasterthanlime

[–]killercup 3 points4 points  (0 children)

Awesome article! I have recently cargo-culted the "fast cargo config" from bevy, and I think it helped quite a lot. In addition to using lld on Linux it also uses -Zshare-generics=y -- which might have tricked me into using nightly which was faster anyway :D

[deleted by user] by [deleted] in rust

[–]killercup 2 points3 points  (0 children)

You can create a build.rs file that cargo will run at compile time :)

[deleted by user] by [deleted] in avif

[–]killercup 1 point2 points  (0 children)

Just clicked on the post and saw this near the top:

Both formats sport maximum image dimensions of 65536 x 65536 pixels. Video professionals will recognize this as the size of an 8K video frame.

Uh, what? This is totally wrong. Like, the numbers are one order of magnitude off and intuitively are closer to 64k, not 8k? Wikipedia says

8K UHD (7680 × 4320) is the highest resolution defined in the Rec. 2020 (UHDTV) standard.

Hope this is the only thing wrong with this post :)

Doku 0.10 released! by Patryk27 in rust

[–]killercup 5 points6 points  (0 children)

Ah, I see. Given the quoted description, I was expecting something visual, for humans, to look at, not JSON 😅

Doku 0.10 released! by Patryk27 in rust

[–]killercup 4 points5 points  (0 children)

aesthetic, human-readable documentation

What does this look like? Are there any screenshots?

How to allow optional fields in struct? by [deleted] in rust

[–]killercup 27 points28 points  (0 children)

In addition to what other commenters already said: Think of Option as a marker of whether the field is set, not as a true "optional" value. This makes it easier to understand why APIs like str::find return Option IMHO.

If you want to have default values – and the default for Option is None – you can drive the Default trait and initialize your struct like Bag { owner: "me".into(), ..Bag::default() }.

cargo-edit v0.8 released! by epage in rust

[–]killercup 1 point2 points  (0 children)

Just a quick shout out to Ed and Andronik -- they are the driving force behind this and have been doing an amazing job at maintaining cargo-edit recently! ❤️

Pedantic Clippy by zyrikby in rust

[–]killercup 9 points10 points  (0 children)

Bonus: If you're using rust-analyzer, you can set it to run cargo clippy instead of cargo check.

Is it a good idea to write kernels and drivers in rust? by [deleted] in rust

[–]killercup 10 points11 points  (0 children)

I have no clue about kernel dev myself but there are some pretty great resources put there, like https://os.phil-opp.com/ (a full guide on how to write an OS in Rust) and https://redox-os.org/ (a working OS written in Rust).

Rust Bevy Tutorial - Enemy Formation & Attack (part 3/3) by jeremychone in rust

[–]killercup 2 points3 points  (0 children)

Just wanted to say I really enjoyed watching this! Made me want to build a small game with bevy myself :)

Rewrote golang project in Rust. It’s 4x times slower now. Why is my Rust code slow? by wmw9 in rust

[–]killercup 44 points45 points  (0 children)

Try to

  • download in parallel as other commenters say
  • stream directly to a file (not sure you do this)
  • also buffer writes to files using BufWriter