<commit_before>---
layout: post
title: Coding Green
categories: [stuff]
tags: [code, general]
comments: true
description: Coding Green - a matter of performance.
---


![100% organic](/assets/images/organic.jpg)



# Green Coding


_"Green coding"? :four_leaf_clover: What about it? I'm not gonna plant trees while coding dude!_


Well, _"green coding"_ :seedling: is not really a thing (or I'm not aware of it yet) but I'm starting to think about it so I'm sharing this to have some feedback.



I have read a thousand times that these emails :email: I'm sending everyday from my phone or laptop are equivalent to driving an average-size car per kilometer.

Add a 1-megabyte email attachment and you could power a low-wattage light bulb for two hours. Oopsie Daisie. :sunflower:


Okay, cool story bro :+1:, but do you really think your 2hours-light-bulb :bulb: saving is worth the pain? And what are you talking about anyway?


Well, emails are one thing. Let's say you're a developper :coffee: (I don't drink coffee, wtf am I doing). You write code, each word adds a few bytes to your files. 
You start a project. You have to add a few features for your application to rock! You want to be as famous as... Pokemon Go!
You add some beautiful images and textures.
A few months later, you have build a 4Mb javascript application, you're really proud. Everything works, it's even fully tested, automated, some black magic even track the users, deploy the code automagically, you don't even need to work anymore. Time for some holidays. :palm_tree:


What now? Your application gets some fame. (moderate) Let's say you have 1000 users a day. :clap: :clap:

Using the previous comparaison, the power you need on one day for your 4Mb application, transfered to 1000 users.... represents the power you need for 3 years with your light bulb turned on 8hours a day. Well, that's not that alarming. Or is it? What if you have 1 million users? 1 Billion? Your impact only gets bigger.


This approximation is obviously simplistic, not even scientific for one second and does not take into account many things like code minification, caching, shared resources etc...

_Plus, this two hours light bulb thing can be found on many websites/blog posts but I haven't found the source of it. What the real footprint of 1Mb in your website assets? I'd appreciate any help._


At some point, we need to realize our footprint matters, as a developper.

Great, now, you feel ashamed to do your job. You can't write less code, your application ain't gonna have features by itself if you do not add it. But you don't want to pollute anymore.

Hold on tiger. :tiger:<commit_msg>Update 2016-07-26-green-coding.markdown<commit_after>---
layout: post
title: Coding Green
categories: [stuff]
tags: [code, general]
comments: true
description: Coding Green - a matter of performance.
---


![100% organic](/assets/images/organic.jpg)



# Green Coding


_"Green coding"? What about it? I'm not gonna plant trees while coding dude!_


Well, _"green coding"_ :seedling: is not really a thing (or I'm not aware of it yet) but I'm starting to think about it so I'm sharing this to have some feedback.



I have read a thousand times that these emails :email: I'm sending everyday from my phone or laptop are equivalent to driving an average-size car per kilometer.

Add a 1-megabyte email attachment and you could power a low-wattage light bulb for two hours. Oopsie Daisie. :sunflower:


Okay, cool story bro :+1:, but do you really think your 2hours-light-bulb saving is worth the pain? And what are you talking about anyway?


Well, emails are one thing. Let's say you're a developper. You write code, each word adds a few bytes to your files. 
You start a project. You have to add a few features for your application to rock! You want to be as famous as... Pokemon Go!
You add some beautiful images and textures.
A few months later, you have build a 4Mb javascript application, you're really proud. Everything works, it's even fully tested, automated, some black magic even track the users, deploy the code automagically, you don't even need to work anymore. Time for some holidays. :palm_tree:


What now? Your application gets some fame. (moderate) Let's say you have 1000 users a day. :clap: :clap:

Using the previous comparaison, the power you need on one day for your 4Mb application, transfered to 1000 users.... represents the power you need for 3 years with your light bulb turned on 8hours a day. Well, that's not that alarming. Or is it? What if you have 1 million users? 1 Billion? Your impact only gets bigger.


This approximation is obviously simplistic, not even scientific for one second and does not take into account many things like code minification, caching, shared resources etc...

_Plus, this two hours light bulb thing can be found on many websites/blog posts but I haven't found the source of it. What the real footprint of 1Mb in your website assets? I'd appreciate any help._


At some point, we need to realize our footprint matters, as a developper.

Great, now, you feel ashamed to do your job. You can't write less code, your application ain't gonna have features by itself if you do not add it. But you don't want to pollute anymore.

Hold on tiger.
{'fraction_non_alphanumeric': 0.0599543205177008, 'fraction_numerical': 0.00951655881233346, 'mean_word_length': 4.087124878993223, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2963793', 'n_tokens_mistral': 1506, 'n_tokens_neox': 1355, 'n_words': 866}