Is Python's "values don't change, they get replaced by new ones stored elsewhere" approach what makes it slow? I would like to see some micro-benchmarks which pin down the bottlenecks. For example, this minimal benchmark with one variable and a few control structures: x=0 for i in range(int(10e6)): if i Runs 5 times slower here than the same in PHP: $x=0; for ($i=0; $i Tested with: time python3 loop.py Which gives me…
Python consumes 38x more energy than Java
51–60 of 142 posts
Re: Python consumes 38x more energy than Java
#52Earlier quoted context omitted.
You seem to be conflating speed and memory usage. A spring boot app will generally be very performant. It will indeed use more memory though.
No man spring boot is hideously slow as well compared to vanilla java. It's pretty fast compared to many other things, but that's just because vanilla java is extremely fast. You often see like 15-30 second start times for springboot apps, which is hilarious and 13-28 seconds longer than it has any business taking.
Any java performance test is generally done against a warmed up VM - which would be representative of the 99.99% of the time the app is running. With or without spring boot.
Re: Python consumes 38x more energy than Java
#53Is Python's "values don't change, they get replaced by new ones stored elsewhere" approach what makes it slow? I would like to see some micro-benchmarks which pin down the bottlenecks. For example, this minimal benchmark with one variable and a few control structures: x=0 for i in range(int(10e6)): if i Runs 5 times slower here than the same in PHP: $x=0; for ($i=0; $i Tested with: time python3 loop.py Which gives me…
You can’t use time command in this sort of benchmark. You are including start up t times here.
time python3 nothing.py
0.011s
time php nothing.php
0.011sRe: Python consumes 38x more energy than Java
#54Re: Python consumes 38x more energy than Java
#55While Java's compiler or JIT is probably one of the most optimized softwares in existence, how do we measure, what overhead the language nudges the programmers to build? I am thinking of AbstractProviderFactoryProxy and similar. Or that for a very long time it forced you (or still does to a degree) to put everything into classes, breeding 1 or 2 generations of programmers, who see a noun and jump to making a class an…
Even when what you Utils.see Utils.is a verb, you Utils.must still Utils.jump to Utils.make a class.
Java 5's static imports at least allow cleaning up the call site, although the documentation advises (in bold) using this feature "very sparingly".
Re: Python consumes 38x more energy than Java
#56Earlier quoted context omitted.
No man spring boot is hideously slow as well compared to vanilla java. It's pretty fast compared to many other things, but that's just because vanilla java is extremely fast. You often see like 15-30 second start times for springboot apps, which is hilarious and 13-28 seconds longer than it has any business taking.
startup time? Any java performance test is generally done against a warmed up VM - which would be representative of the 99.99% of the time the app is running. With or without spring boot.
A java application should be able to start in seconds. An inability to do so is the surefire litmus test for pulling in too many dependencies.
Re: Python consumes 38x more energy than Java
#57Earlier quoted context omitted.
No man spring boot is hideously slow as well compared to vanilla java. It's pretty fast compared to many other things, but that's just because vanilla java is extremely fast. You often see like 15-30 second start times for springboot apps, which is hilarious and 13-28 seconds longer than it has any business taking.
Have you tried Spring native?
Re: Python consumes 38x more energy than Java
#58One should always be skeptical of these sorts of benchmarks, especially against Java, and I say this as primarily a Java developer. Well optimized Java is very lean and can be incredibly performant, but the median modern Java app is an obese cronenberg made out of gigabytes of SpringBoot dependencies. That's not particularly fast; and well optimized python will run circles around it.
You seem to be conflating speed and memory usage. A spring boot app will generally be very performant. It will indeed use more memory though.
Re: Python consumes 38x more energy than Java
#59Earlier quoted context omitted.
I did an excercise some time ago and managed to get two file transfer apps, one in Rust and one in Java, where the performance was effectively the same (in some cases with a slight Java edge!), but the memory consumption was orders of magnitude in favor of Rust. The JVM is a wonder of engineering, and Java is indeed quite fast.
Aren't file transfers done by the kernel via sys-calls? All languages would be equally fast, given they don't do something stupid like reading and writing individual bytes.