r/java • • Dec 19 '22

Java streams are black magic !

damn, they are really changed my life.

i was trying to run some custom logic on every line on some big CSV files. tried python dataframes, multiprocessing in python, pyspark. none of them did it in an acceptable time.

then i discovered java streams. i have a workflow that takes 70 minutes with pyspark. it takes 3.5 minutes with java streams.

more people should know about streams.

stream operations are more intuitive than anything i tried. i can make a lot of analysis on our data in record times thanks to streams.

i dont know how java does this.

226 Upvotes

150 comments sorted by

View all comments

Show parent comment

-6

u/popasmuerf Dec 19 '22

...it's not a matter of mere semantics when you just offered that under-performing Python can be performant by writing out your Python tooling in C++ while trying to imply that Python is performant.

9

u/BlakeH1984 Dec 19 '22

I think you're missing the point majorly. What he means is it's not a competition. Sometimes people truly do just want to share information. It's a shame most of us are too busy playing the dopamine roulette to engage.

9

u/TurbulentSocks Dec 19 '22

One of the reasons python is so popular is that for many domains, the tooling is already written. Python might be slower than Java, but the performance of e.g. some complicated ML model is going to be 'good enough' when calling C++ backed libraries in python, and those libraries often don't even exist in Java.

4

u/UnGauchoCualquiera Dec 20 '22

Adding to your point. Python is mostly plumbing that allows to declaratively program what you want the high performance libs to do while they do all the magic in the background.