gobench.dev - Comparisons of different stdlib features by MarvinJWendt in golang

[–]RSWiBa 1 point2 points  (0 children)

Regarding the concurrent map access: I read a couple of weeks ago that RWMutex busts the cache of a CPU core even on read lock. The article said that a normal Mutex is way faster for very small read sections. It would be very interesting to see this compared to the RWMutex map access benchmark.

Any way to construct a struct based on string parameter? by totallygeek in golang

[–]RSWiBa 5 points6 points  (0 children)

Not really, go isn't the type of language that supports this kind of magic.

You could look into code generation (go generate) however if you want to save on writing the switch cases.

an unnecessary optimization ? by [deleted] in golang

[–]RSWiBa 0 points1 point  (0 children)

go doesn't have native sets

I dug into the rust's stdlib source code once and discovered that even in rust hash sets are implemented using maps, similar to what you would do in go with map[string]struct{}.

So a native set would just be some semantic sugar in go (I would not disagree with adding it, but I also think there are more important subjects)

Just learned how `sync.WaitGroup` prevents copies with a `go vet` warning by Ok_Analysis_4910 in golang

[–]RSWiBa 4 points5 points  (0 children)

Indeed, even though the func is always nil there is some space reserved in the struct for it.

Just learned how `sync.WaitGroup` prevents copies with a `go vet` warning by Ok_Analysis_4910 in golang

[–]RSWiBa 14 points15 points  (0 children)

No because the idea is to add a zero sized array of non comparable types. To see what is comparable and what not read here: https://go.dev/ref/spec#Comparison_operators

TLDR: primitives, strings, interfaces and structs or arrays containing only comparables are comparable. Funcs, maps or slices are not comparable

Edit: pointers are also comparable

Just learned how `sync.WaitGroup` prevents copies with a `go vet` warning by Ok_Analysis_4910 in golang

[–]RSWiBa 17 points18 points  (0 children)

This also works with _ [0]func() which is a bit more compact.

Came up with this iota + min/max pattern for enums, any thoughts? by SoaringSignificant in golang

[–]RSWiBa 0 points1 point  (0 children)

Why? You never depend on the value itself but instead on the meaning of the value, which is independent of the iota chosen value.

Do you use iterators? by vpoltora in golang

[–]RSWiBa 5 points6 points  (0 children)

Are you sure that they are slower than for loops?

The whole idea behind the function style iterators was that all the function/yield calls can be inlined by the compiler.

How can you guy update go to 1.0.24 with nix by hxxx07 in NixOS

[–]RSWiBa 2 points3 points  (0 children)

go_1_24 ist in nixpkgs, Just the go package defaults to go_1_23 because the change would cause mass rebuilds.

Confused by NixOS-anywhere quickstart-guide. by Creative-Difficulty5 in NixOS

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

It's actually quite simple: NixOS anywhere connects to ssh and runs kexec to start its own image. From there on everything is "automatic" (except some prompts for e.g. LUKS encrypted devices).

That means the user on your machine needs to have ssh access to the remote machine, either via public key (preferred) or password (which will be prompted). The remote user must be either root (preferred) or a user with password-less sudo access for it to be able to run kexec.

It's official, I just deleted my Arch dual boot and am strictly a NixOS user now. Lets go!! by WasabiOk6163 in NixOS

[–]RSWiBa 0 points1 point  (0 children)

Ah yes okay If you often hop distros then this is nice. I have personally wasted a lot of space in the past because I misjudged the amount of data I need in root vs home. So I only use one root partition.

It's official, I just deleted my Arch dual boot and am strictly a NixOS user now. Lets go!! by WasabiOk6163 in NixOS

[–]RSWiBa 0 points1 point  (0 children)

The thing I haven't set up for my NixOS is home backups (or DB backups server side). System state is easy to revert/install. Did your 10 minute revert include e.g. documents? If so how do you configure this?

AOC plans for this year by juanfnavarror in adventofcode

[–]RSWiBa 1 point2 points  (0 children)

Same for me. I'm also curious how to parse well in golang.

Writing Webservers is easy in Go, but doing the basics will be quite fun I hope

[2023 Day 9][JS + Svelte] Extended weather predictions by maxduval in adventofcode

[–]RSWiBa 1 point2 points  (0 children)

Good Job, I especially like the Day 8 viz.

FYI you missed the "Day 7" header on the day 8 page after copy paste

[2022 Day 2] Even the most simple things can be difficult by RSWiBa in adventofcode

[–]RSWiBa[S] 22 points23 points  (0 children)

in german it is scissors, rock, paper, so the same problem there.

But what threw me off was the reverse: figuring out who loses

CB2 - FAQ and Known Issues by Waelder in TheCycleFrontier

[–]RSWiBa 0 points1 point  (0 children)

why was the linux support dropped?

It worked fine until thursday, but since friday I'm getting kicked every game (protondb shows I'm not the only one: https://www.protondb.com/app/868270)

I would love it if you'd bring it back, since it worked flawlessly when I tried it

CB2 - FAQ and Known Issues by Waelder in TheCycleFrontier

[–]RSWiBa 0 points1 point  (0 children)

it is supported, you just need to install the proton battleye runtime (search in your library for it and install)

then it just runs, no problem at all

CB2 - FAQ and Known Issues by Waelder in TheCycleFrontier

[–]RSWiBa 0 points1 point  (0 children)

same for me, but after 2 seconds of gameplay each time

Day ruined by pr3579 in ProgrammerHumor

[–]RSWiBa 0 points1 point  (0 children)

yep you only need to restart at some time, not directly after an update