|
|
Log in / Subscribe / Register

The moral dimension of performance

The moral dimension of performance

Posted Aug 30, 2017 17:49 UTC (Wed) by aigarius (guest, #7329)
In reply to: The moral dimension of performance by ncm
Parent article: Redesigning Python's named tuples

Python is not much slower than other languages in execution. But it is much faster in writing. And people have far more impact on environment that a few kWh of electricity. By needing more man hours to write the same program, you are killing species. Save the world - program in Python.


to post comments

The moral dimension of performance

Posted Aug 30, 2017 19:38 UTC (Wed) by smckay (guest, #103253) [Link] (2 responses)

I don't consume more CO2 when coding Java vs. Python.

The moral dimension of performance

Posted Aug 30, 2017 20:51 UTC (Wed) by sfeam (subscriber, #2841) [Link] (1 responses)

consume CO2? You mean like by pouring fizzy water into your single malt before drinking it?

The moral dimension of performance

Posted Aug 31, 2017 19:05 UTC (Thu) by smckay (guest, #103253) [Link]

I meant "produce", or maybe more accurately "have CO2 emissions attributable to me", but I do drink a lot of soda.

The moral dimension of performance

Posted Sep 1, 2017 10:47 UTC (Fri) by edeloget (subscriber, #88392) [Link] (3 responses)

Small performance improvements on heavily used code have large practical impacts on energy consumption. If one million machine, each consuming 250W/h, see a 1 s improvement in the handling of a particular repeated 1 minute-long task, that's an collective economy of 70kW each time they execute the script, and that amount to 10 MW over the course of one single day.

Given how much Python is used today, how much energy can be saved if we make it 0.1% faster ?

I'm not sure the time spent by a human to write that change will ever have the impact.

For the record, although I cannot find the reference again, Andreï Alexandrescu of Facebook once stated that a millisecond improvement on each page loading was worth millions of dollars in electricity alone. He spent most of his tenure at Facebook working on how to optimize the various tools Facebook was using to serve pages.

Program performance matters.

The moral dimension of performance

Posted Sep 2, 2017 8:42 UTC (Sat) by aigarius (guest, #7329) [Link]

Sure, improving speed of Python is a good thing. The original poster was arguing that by writing *anything* in Python you are being responsible for killing nature. For most of software the execution speed of a language is nowhere near the performance bottleneck - there are network and disk delays, there is user input latency and coordination with other systems. So my counterargument is that by pushing people from easy to write and maintain Python to some faster, but harder language you save milliseconds per execution while costing man-weeks or man-months in development time which means more food being prepared for the programmers, more driving to work and a bunch of other energy expenditure that easily dwarfs even millions of seconds of extra CPU time.

The moral dimension of performance

Posted Sep 2, 2017 18:11 UTC (Sat) by mb (subscriber, #50428) [Link] (1 responses)

>each consuming 250W/h,
>that's an collective economy of 70kW each time they execute the script,
>and that amount to 10 MW over the course of one single day.

Your usage of Watts does not make sense at all.

>Program performance matters.

That partially right. But it does not matter most of the time. Most code is not executed that frequently.

The moral dimension of performance

Posted Sep 2, 2017 19:03 UTC (Sat) by karkhaz (subscriber, #99844) [Link]

I've been following this thread with interest, hoping that somebody would post some actual numbers. (disclaimer, I don't have any either). The grandparent comment posted some energy numbers per time of running a python script, but I doubt anybody knows how much time is spent running python scripts.

At some point, I became very interested in working out what changes in my lifestyle I could make to help protect the environment. Even incredibly simple decisions turn out to be insanely complicated to work out---things like "given the choice, should I dry my hands with the electric dryer or using paper towels"? The answers are often very counterintuitive and I'm now very skeptical of claims that doing X is better for the environment than Y. Or you have studies like [0] that focus on one tiny area of life (disposable vs. reusable cups), and even that doesn't tell you which is "better" for the environment but focuses only on energy usage (neglecting, for example, waste and pollution during manufacture; the renewability of raw materials for each kind of cup, and whether they can be recycled; etc).

[0] http://sustainability.tufts.edu/wp-content/uploads/Compar...

More on-topic, I have colleagues who have done academic work on automatically removing fence/barrier instructions from programs (in a safe way, i.e. the compiler was being conservative when it inserted them) because fences use a lot of power on a CPU or GPU (the whole cache needs to get flushed, all values need to be committed to memory, etc) and a big motivation is saving power in data centers. They generally do have numbers, because it's a tiny specialized problem that can be easily measured.

At a glance, both sides in this thread seem meaningless without further context. Programmer time probably wastes more energy if the program doesn't run on many devices, but if the program is running in a data center then an epsilon-sized energy saving might dwarf any number of programmer-hours. But I honestly haven't worked out the numbers myself, and I don't know what proportion of code in the wild runs on data centers versus running on mobile phones versus running in a traffic light. These things (and many, many more) would need to be known before making the claim that X saves more power than Y. I wish we had better data.

The moral dimension of performance

Posted Sep 1, 2017 21:33 UTC (Fri) by HelloWorld (guest, #56129) [Link] (1 responses)

> Python is not much slower than other languages in execution.
Seriously?
https://benchmarksgame.alioth.debian.org/u64q/compare.php...
And this is to be expected, dynamic typing tends to make things go slow.

> But it is much faster in writing.
If you compare with old-fashioned languages like C, Java or Go, then certainly. If you compare to statically typed, functional languages (e. g. Scala), then no. A good static type system is a huge boon for maintenance, productivity and tooling, and so is functional programming. Python supports neither, which pretty much disqualifies it for serious projects as far as I'm concerned.

The moral dimension of performance

Posted Sep 17, 2017 12:55 UTC (Sun) by mathstuf (subscriber, #69389) [Link]

I agree about the productivity thing. Usually I have my inputs and know where the output is going, so I wire up or declare these first and then code up the middle. The compiler tells me where my code shape doesn't work which is much better than "looks like it worked" followed by debugging in dynamic languages.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds