Gobbel2000

joined 2 years ago
[–] [email protected] 7 points 1 year ago

Hui, wie divers!

[–] [email protected] 35 points 1 year ago

This is not cool of Twitter.

[–] [email protected] 23 points 1 year ago (2 children)

Being active is probably most important.

Maybe it would be possible to get a link into a "This Week in Rust"?

[–] [email protected] 1 points 1 year ago (3 children)

Where are these circles coming from!?

[–] [email protected] 4 points 1 year ago

That commonwealth is called the EU today and, along with NATO, is the reason why these countries are in a comparitively safer position. It would be much riskier for Russia to invade there.

[–] [email protected] 348 points 1 year ago (10 children)

lemmy.made.me.look.at.this.each.time.i.open.a.terminal

Hostnames can be up to 64 characters long in Linux.

[–] [email protected] 4 points 1 year ago

I use Colemak where most punctuation is at the same place as in the US English layout, which programming languages seem to be optimized toward. For the layout I prefer ISO for the larger Enter key.

[–] [email protected] 84 points 1 year ago (2 children)

That's sad that Mozilla has to take it into their own hands to provide a proper alternative to Snap Firefox.

[–] [email protected] 20 points 1 year ago

"Würstel Bianchi" als Übersetzung von Weißwürsten finde ich gut.

[–] [email protected] 2 points 2 years ago

Rust

I simply check each starting position individually for Part 2, I don't know if there are more clever solutions. Initially that approach ran in 180ms which is a lot more than any of the previous puzzles needed, so I tried if I could optimize it.

Initially I was using two hash sets, one for counting unique energized fields, and one for detecting cycles which also included the direction in the hash. Going from the default rust hasher to FxHash sped it up to 100ms. Seeing that, I thought that this point could be further improved upon, and ended up replacing both hash sets with boolean arrays, since their size is neatly bounded by the input field size. Now it runs in merely 30ms, meaning a 6x speedup just by getting rid of the hashing.

[–] [email protected] 1 points 2 years ago (1 children)

You can create an array filled with all the same values in Rust, but only if all values have the same memory representation because they will be copied. That just doesn't work with Vec's, because they must all have their own unique pointer. And to have uninitialized values at first (think NULL-pointers for every Vec) while creating each Vec, something like this is apparently needed.

The appropriate way would certainly have been to store the map as a Vec> instead of an array, but I just wanted to see if could.

[–] [email protected] 5 points 2 years ago (4 children)

Rust

Part 1 was super simple with wrapping_add and wrapping_mul on a u8. Building an actual hash map in Part 2 was nice.

view more: ‹ prev next ›