this post was submitted on 26 Mar 2025
518 points (96.9% liked)

Programmer Humor

22039 readers
1204 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 21 points 2 days ago (5 children)

Oh wow, a programming language that is not supposed to be used for every single software in the world. Unlike Javascript for example which should absolutely be used for making everything (horrible). Nodejs was a mistake.

load more comments (5 replies)
[–] [email protected] 141 points 3 days ago (3 children)

all programs are single threaded unless otherwise specified.

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

I initially read this as “all programmers are single-threaded” and thought to myself, “yeah, that tracks”

[–] [email protected] 45 points 3 days ago (3 children)

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

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

And yet: You’ll still be limited to two simultaneous calls to your REST API because the default HTTP client was built in the dumbest way possible.

[–] [email protected] 1 points 21 hours ago

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

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

But it's still not a guarantee

[–] [email protected] 1 points 21 hours ago

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

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

I absolutely love how easy multi threading and communication between threads is made in Go. Easily one of the biggest selling points.

[–] [email protected] 1 points 21 hours ago (1 children)

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

[–] [email protected] 1 points 14 hours ago* (last edited 14 hours ago)

Well, they're userspace threads. That's still concurrency just like kernel threads.

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

[–] [email protected] 23 points 3 days ago (2 children)

Does Python have the ability to specify loops that should be executed in parallel, as e.g. Matlab uses parfor instead of for?

[–] [email protected] 51 points 3 days ago (2 children)

python has way too many ways to do that. asyncio, future, thread, multiprocessing...

[–] WolfLink 39 points 3 days ago (1 children)

Of the ways you listed the only one that will actually take advantage of a multi core CPU is multiprocessing

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

yup, that's true. most meaningful tasks are io-bound so "parallel" basically qualifies as "whatever allows multiple threads of execution to keep going". if you're doing numbercrunching in pythen without a proper library like pandas, that can parallelize your calculations, you're doing it wrong.

[–] WolfLink 7 points 2 days ago* (last edited 2 days ago) (1 children)

I’ve used multiprocessing to squeeze more performance out of numpy and scipy. But yeah, resorting to multiprocessing is a sign that you should be dropping into something like Rust or a C variant.

[–] [email protected] 1 points 2 days ago

Most numpy array functions already utilize multiple cores, because they're optimized and written in C

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

I've always hated object oriented multi threading. Goroutines (green threads) are just the best way 90% of the time. If I need to control where threads go I'll write it in rust.

[–] [email protected] 7 points 3 days ago (4 children)

nothing about any of those libraries dictates an OO approach.

load more comments (4 replies)
[–] [email protected] 7 points 3 days ago (2 children)

Are you still using matlab? Why? Seriously

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

No, I'm not at university anymore.

[–] [email protected] 4 points 3 days ago (1 children)
[–] [email protected] 5 points 3 days ago* (last edited 3 days ago) (1 children)

We weren't doing any ressource extensive computations with Matlab, mainly just for teaching FEM, as we've had an extensive collection of scripts for that purpose, and pre- and some post processing.

load more comments (1 replies)
[–] [email protected] 7 points 3 days ago (1 children)

I was telling a colleague about how my department started using Rust for some parts of our projects lately. (normally Python was good enough for almost everything but we wanted to try it out)

They asked me why we're not using MATLAB. They were not joking. So, I can at least tell you their reasoning. It was their first programming language in university, it's safer and faster than Python, and it's quite challenging to use.

[–] [email protected] 4 points 2 days ago

"Just use MATLAB" - Someone with a kind heart who has never deployed anything to anything

[–] [email protected] 9 points 2 days ago

I tough this was about excel and was like yeah haha!

But is about Python, so I'm officially offended.

[–] [email protected] 25 points 2 days ago (1 children)
[–] [email protected] 4 points 2 days ago (2 children)

Oooooh this is really cool, thanks for sharing. How could I install it on Linux (Ubuntu)? I assume I would have to compile CPython. Also, would the source of the programs I run need any modifications?

[–] [email protected] 4 points 2 days ago

In this case, it's a feature of the language that enables developers to implement greater amounts of parallelism. So, the developers of the Python-based application will need to refactor to take advantage of it.

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

From memory I can only answer one of those: The way I understand it (and I could be wrong), your programs theoretically should only need modifications if they have a concurrency related bug. The global interlock is designed to take a sledgehammer at "fixing" a concurrency data race. If you have a bug that the GIL fixed, you'll need to solve that data race using a different control structure once free threading is enabled.

I know it's kind of a vague answer, but every program that supports true concurrency will do it slightly differently. Your average script with just a few libraries may not benefit, unless a library itself uses threads. Some libraries that use native compiled components may already be able to utilize the full power of you computer even on standard Python builds because threads spawned directly in the native code are less beholden to the GIL (depending on how often they'd need to communicate with native python code)

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

Thanks for the answer, I really hope Synapse will be able to work with concurrency enabled.

[–] [email protected] 15 points 2 days ago

let's be honest here, he actually means 0.01 core performance

[–] [email protected] 16 points 2 days ago (2 children)

don't worry it'll use all the RAM anyway

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

I paid for all the memory. I'll use all the memory.

[–] [email protected] 2 points 1 day ago

JG Memoryworth

[–] [email protected] 6 points 2 days ago

No RAM gets wasted!

[–] [email protected] 8 points 2 days ago
[–] [email protected] 5 points 2 days ago

It only took us how many years?

[–] [email protected] 11 points 3 days ago (3 children)

Do you mean Synapse the Matrix server? In my experience, Conduit is much more efficient.

[–] [email protected] 6 points 2 days ago

i wish they would switch the reference implementation to conduit

there is core components on the client side in rust so maybe that's the way for the future

[–] [email protected] 4 points 2 days ago

Yep, I mean as in matrix. There is currently no was to migrate to conduit/conduwuit. Btw from what I've seen conduwuit is more full-featured.

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

I may have something to read up on.

load more comments (1 replies)
[–] [email protected] 11 points 3 days ago* (last edited 3 days ago)

I prefer this default. Im sick of having to rein in Numba cores or OpenBlas threads or other out of control software that immediately tries to bottleneck my stack.

CGroups (Docker/LXC) is the obvious solution, but it shouldn't have to be

[–] [email protected] 9 points 3 days ago

Python

..so.. so you made it single threaded?

[–] [email protected] 7 points 3 days ago

I'll be honest, this only matters when running single services that are very expensive. it's fine if your program can't be pararlelized if the OS does its job and spreads the love around the cpus

load more comments
view more: next ›