firelizzard

joined 2 years ago
[–] firelizzard@programming.dev 8 points 3 months ago (4 children)

And relying on runtime validation is a horrific way to write production code

[–] firelizzard@programming.dev 12 points 3 months ago (4 children)

Assembly languages are always architecture specific. Thats kind of their defining feature. Assembly is readable machine code.

[–] firelizzard@programming.dev 8 points 3 months ago (6 children)

“Assume it’s a map and treat like a map and then catch the type error if it’s not.” Paraphrased from actual advice by Guido on how you should write Python. Python isn’t a bad language but the philosophy that comes along with it is so fucked.

[–] firelizzard@programming.dev 1 points 3 months ago (1 children)

What I mean is, from the perspective of performance they are very different. In a language like C where (p)threads are kernel threads, creating a new thread is only marginally less expensive than creating a new process (in Linux, not sure about Windows). In comparison creating a new 'user thread' in Go is exceedingly cheap. Creating 10s of thousands of goroutines is feasible. Creating 10s of thousands of threads is a problem.

Also, it still uses kernel threads, just not for every single goroutine.

This touches on the other major difference. There is zero connection between the number of goroutines a program spawns and the number of kernel threads it spawns. A program using kernel threads is relying on the kernel's scheduler which adds a lot of complexity and non-determinism. But a Go program uses the same number of kernel threads (assuming the same hardware and you don't mess with GOMAXPROCS) regardless of the number of goroutines it uses, and the goroutines are cooperatively scheduled by the runtime instead of preemptively scheduled by the kernel.

[–] firelizzard@programming.dev 1 points 3 months ago (3 children)

Key point: they're not threads, at least not in the traditional sense. That makes a huge difference under the hood.

[–] firelizzard@programming.dev 2 points 3 months ago

Really? Huh, TIL. I guess I've just never run into a situation where that was the bottleneck.

[–] firelizzard@programming.dev 1 points 3 months ago

Definitely not a guarantee, bad devs will still write bad code (and junior devs might want to let their seniors handle concurrency).

[–] firelizzard@programming.dev 47 points 3 months ago (11 children)

It’s safe to assume that any non-trivial program written in Go is multithreaded

[–] firelizzard@programming.dev 1 points 3 months ago

You can also just tell GitHub to not do that.

[–] firelizzard@programming.dev 12 points 3 months ago

Unless I have an external monitor, keyboard, and mouse, using an external keyboard with a laptop is a shitty experience for me. And if I’m at home and trying to get work done, I’m using my desktop PC.

[–] firelizzard@programming.dev 2 points 4 months ago

Why are you memeing about me? I don’t appreciate being made fun of.

[–] firelizzard@programming.dev 0 points 5 months ago* (last edited 5 months ago)

If your job is to make websites and you make sites that don’t work on a browser that has over 100 million users you’re not doing your job.

view more: ‹ prev next ›