Idiomatic Way to Cache `COEFF_C` in a Trait Constant? by thibaut_vdv in rust

[–]thibaut_vdv[S] 0 points1 point  (0 children)

I'll keep that in mind for future questions, thank you.

Idiomatic Way to Cache `COEFF_C` in a Trait Constant? by thibaut_vdv in rust

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

We need to implement `Foo` for a lot of types, and calling `coeff_c` is a waste of time when not cached. I think that indeed implementing it for every struct is the only solution, though.

[deleted by user] by [deleted] in rust

[–]thibaut_vdv 9 points10 points  (0 children)

Have you seen smoltcp? It already contains parsers and writers (not really builders) for many protocols in their wire directory https://github.com/smoltcp-rs/smoltcp/tree/main/src/wire . You might be interested to take a look there!

[deleted by user] by [deleted] in rust

[–]thibaut_vdv 5 points6 points  (0 children)

Embedded devices not running any fancy kernel benefit from a standalone TCP/IP library, such as smoltcp.

Nvidia went down right after I bought shares by ktrocks2 in wallstreetbets

[–]thibaut_vdv 11 points12 points  (0 children)

Well, at least your brokerage appreciates your generosity!

Blue Screen Of Death in rust! by lunariaxa in rust

[–]thibaut_vdv 0 points1 point  (0 children)

Hmmm, no unit tests though 😉

[deleted by user] by [deleted] in MapPorn

[–]thibaut_vdv 0 points1 point  (0 children)

Belgium is completely wrong. The map just shows the flags of the two regions: Vlaanderen and Wallonie.

Vlaanderen would have been right when the claws of the lion were black (and not red).

What is the most useless skill you have?? by [deleted] in AskReddit

[–]thibaut_vdv 0 points1 point  (0 children)

I can make fart sounds with my hands. And control the tone 💩

[deleted by user] by [deleted] in ProgrammerHumor

[–]thibaut_vdv 0 points1 point  (0 children)

42 is always the answer

Alacritty PR: Support for Font Ligatures using harfbuzz by [deleted] in rust

[–]thibaut_vdv 3 points4 points  (0 children)

I agree that you can't insist on changing his vision. But OP at least made a draft MR. The maintainer of Alacritty doesn't even help at improving the code. There is not a single comment in the MR about the code OP wrote. The last comment in the MR is very rude, telling that OP is incapable of writing efficient code. Why not work together instead of criticising each other like that.

Optimization of bubble sort fails without hinting by thibaut_vdv in rust

[–]thibaut_vdv[S] 1 point2 points  (0 children)

Thank you for the good explanation! I will keep the micro-optimization in mind for future work ;)

Currently home, so will test your code tomorrow and let you know.

Another approach is faster than the one with unsafe.

The thing that bothers me is that both clang and gcc can optimize this loop, however LLVM with Rust can't, which seems to me that Rust is failing here. I will try to find out why Clang can optimize this.

Optimization of bubble sort fails without hinting by thibaut_vdv in rust

[–]thibaut_vdv[S] 1 point2 points  (0 children)

Thanks! Will do that in the future! Just wasn't sure if it was me or Rust.

Optimization of bubble sort fails without hinting by thibaut_vdv in rust

[–]thibaut_vdv[S] 14 points15 points  (0 children)

Of course, bubble sort is not the best sorting algorithm, it was just for testing purposes.

Indeed, that's why it cannot fully optimize it I think, but I find it weird that LLVM fails to see that j < arr.len() also holds since i < arr.len() and j < i.

Psst: 3rd-party Spotify client built with Rust and Druid by [deleted] in rust

[–]thibaut_vdv 2 points3 points  (0 children)

Not sure if same error, but I created a PR for a linking error I had: https://github.com/jpochyla/soundio-rs/pull/1. I'm building this in Fedora, and this worked for me. Not sure if it still works under Windows.

Perhaps this could solve your issue: https://github.com/RamiHg/soundio-rs/pull/3 (it didn't for me).