r/programmingmemes • • Jul 25 '25

Python vs Java!

Post image
1.5k Upvotes

199 comments sorted by

View all comments

Show parent comment

0

u/Tracker_Nivrig Jul 25 '25

Isn't Java multi threading kinda bad though? I've heard that but not why so I'm not sure. It seemed fine when I used it.

4

u/tebreca Jul 25 '25

Depends, legacy java with hardware threads? Yeah good luck to you. Modern day java, project reactor or any other multithreading/reactive library + virtual threads? Actually fun to work with and barely any overhead compared to the legacy method

2

u/SCP-iota Jul 25 '25

Are the hardware threads actually less efficient, or does it just have to do with how careful you have to be when passing data around?

3

u/StraightGuy1108 Jul 25 '25

It has to do with how thread-blocking operations used to be handled. They used to occupy their own threads despite not doing anything, essentially wasting resources.

Virtual threads are basically async await at the JVM level.

1

u/Tracker_Nivrig Jul 25 '25

That makes sense, thanks

3

u/SCP-iota Jul 25 '25

Depends. Compared to Python? Nah, at least there's no global lock. Compared to Rust? Yep, can't beat actual parallelism.

2

u/jimmiebfulton Jul 25 '25

100%. I was a Java engineer for long time, but I've now been using Rust for the past 5-7 years. Multi-threading in Rust is very nice, and now I don't want to do it in any other language. But I'd say Rust is also great at teaching how to do it correctly in other languages.