Energy Efficiency in Programming Languages
Provides a benchmarking tool to measure energy efficiency across various programming languages using Docker.
https://github.com/nicovank/energy-languages
Category: Consumption
Sub Category: Computation and Communication
Keywords from Contributors
clbg languages clang compile gcc pending zig
Last synced: 24 minutes ago
JSON representation
Repository metadata
- Host: GitHub
- URL: https://github.com/nicovank/energy-languages
- Owner: nicovank
- License: apache-2.0
- Created: 2022-10-19T16:44:25.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-11-12T19:32:16.000Z (2 months ago)
- Last Synced: 2026-01-11T13:10:52.197Z (4 days ago)
- Language: C
- Homepage:
- Size: 48.6 MB
- Stars: 14
- Watchers: 1
- Forks: 2
- Open Issues: 0
- Releases: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
Energy Efficiency in Programming Languages
Nicolas van Kempen,
Hyuk-Je Kwon,
Dung Tuan Nguyen,
Emery Berger.
Documentation
Requirements
Running the measurement tool requires:
- an Intel processor with RAPL support.
- Linux (tested on Ubuntu 22.04).
Docker
The easiest way to run these benchmarks is using Docker:
% sudo modprobe msr # Enable msr kernel module.
% sudo python3 -m scripts.build_docker_image
% sudo docker run --privileged -v [OUTPUT_DIRECTORY]:/root/data energy-languages [OPTIONS]
Here is an example running all languages/benchmarks pairs:
% sudo docker run -it --rm --privileged -v `pwd`/data/`hostname -s`/docker-default:/root/data energy-languages \
--languages C C++ Rust Go Java C\# JavaScript TypeScript PHP Python PyPy Lua LuaJIT \
--warmup 1 \
--iterations 21 \
--timeout 10000
Running additional experiments:
% sudo docker run -it --rm --privileged -v `pwd`/data/`hostname -s`/docker-default:/root/data energy-languages \
--benchmark-root experiments \
--languages "C as C++" "Go-no-GC" "JavaScript as TypeScript" \
--warmup 1 \
--iterations 21 \
--timeout 10000
Running Java-N experiments:
% sudo ./scripts/docker-java-n.sh Java docker-default
Processors can be set to their minimum frequency with the following commands:
# Use frequency-info to check the defaults for your machine.
% cpupower frequency-info
# Pin to lowest possible frequency.
% echo 1 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
% sudo cpupower frequency-set --governor powersave
% sudo cpupower frequency-set --max 800Mhz
# Restore defaults after running experiments.
% echo 0 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
% sudo cpupower frequency-set --governor powersave
% sudo cpupower frequency-set --max 3.4GHz
Finally, experiments can be pinned to a single code by using Docker's
--cpuset-cpus option, specifying a core number. For example:
% sudo docker run -it --rm --privileged --cpuset-cpus=13 [...]
Figures
Average power draw as a function of the average number of cores used

% python3 -m scripts.normalize_cores \
--data-root data/`hostname -s`/docker-default \
--languages C C++ Rust Go Java C\# JavaScript TypeScript PHP Python PyPy Lua LuaJIT
Average power draw as a function of memory activity

% python3 -m scripts.dram \
--data-root data/`hostname -s`/docker-default \
--languages C C++ Rust Go Java C\# JavaScript TypeScript PHP Python PyPy Lua LuaJIT
Average power draw controlling for external factors

% python3 -m scripts.fixed_time \
--data-root data/`hostname -s`/docker-min-freq-cpuset-13 \
--languages C C++ Rust Go Java C\# JavaScript TypeScript PHP Python PyPy Lua LuaJIT
Other
A few other scripts can be useful to generate figures and results.
Their options are self-explanatory and/or documented in the --help message.
Notably:
scripts.table: Build two tables comparing runtime and energy
consumption for a list of languages.scripts.barchart: Compare two implementations of the same programming
language.scripts.java_n: Generate a figure for a given benchmark of time per
iteration as a function of number of iterations.
License
The original benchmark suite, the
Computer Language Benchmark Game,
is under
BSD-3-Clause.
Code from
the repository this one originally forked from
is under
MIT.
Any other code in this repository is under Apache-2.0.
Owner metadata
- Name: Nicolas van Kempen
- Login: nicovank
- Email:
- Kind: user
- Description:
- Website: https://nvankempen.com
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/7906725?u=4531d70382beb4e29b82203798126df2e3e8f631&v=4
- Repositories: 32
- Last ynced at: 2024-04-27T00:18:37.901Z
- Profile URL: https://github.com/nicovank
GitHub Events
Total
- Watch event: 7
- Delete event: 1
- Push event: 21
- Create event: 2
Last Year
- Watch event: 2
- Delete event: 1
- Push event: 21
- Create event: 2
Committers metadata
Last synced: 2 days ago
Total Commits: 644
Total Committers: 13
Avg Commits per committer: 49.538
Development Distribution Score (DDS): 0.109
Commits in past year: 33
Committers in past year: 1
Avg Commits per committer in past year: 33.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Nicolas van Kempen | n****p@g****m | 574 |
| Dung Tuan Nguyen | n****r@g****m | 28 |
| MarcoCouto | m****0@g****m | 11 |
| Hyuk-Je Kwon | h****n@g****m | 7 |
| root | r****t@o****u | 7 |
| dependabot[bot] | 4****] | 6 |
| States | r****3@g****m | 4 |
| Green Software Lab | g****b@d****t | 2 |
| michaljroszak | 4****k | 1 |
| Logan Kilpatrick | 2****3@g****m | 1 |
| José Nuno Macedo | j****o@i****t | 1 |
| Felipe Móz | 6****z | 1 |
| Ben Albrecht | b****t | 1 |
Committer domains:
- inesctec.pt: 1
- di.uminho.pt: 1
- obelix96.cs.umass.edu: 1
Issue and Pull Request metadata
Last synced: 5 months ago
Total issues: 5
Total pull requests: 40
Average time to close issues: 2 months
Average time to close pull requests: 3 days
Total issue authors: 1
Total pull request authors: 4
Average comments per issue: 0.8
Average comments per pull request: 0.5
Merged pull request: 35
Bot issues: 0
Bot pull requests: 6
Past year issues: 0
Past year pull requests: 1
Past year average time to close issues: N/A
Past year average time to close pull requests: about 8 hours
Past year issue authors: 0
Past year pull request authors: 1
Past year average comments per issue: 0
Past year average comments per pull request: 7.0
Past year merged pull request: 1
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- nicovank (4)
Top Pull Request Authors
- nicovank (25)
- dependabot[bot] (9)
- hyukjekwon (6)
- dungwinux (4)
Top Issue Labels
Top Pull Request Labels
- dependencies (9)
Package metadata
- Total packages: 2
- Total downloads: unknown
- Total dependent packages: 0 (may contain duplicates)
- Total dependent repositories: 0 (may contain duplicates)
- Total versions: 0
proxy.golang.org: github.com/nicovank/Energy-Languages
- Homepage: https://github.com/nicovank/Energy-Languages
- Documentation: https://pkg.go.dev/github.com/nicovank/Energy-Languages#section-documentation
- Licenses: Apache-2.0
- Latest release: (published 3 days ago)
- Last Synced: 2026-01-12T07:09:38.474Z (3 days ago)
- Versions: 0
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.313%
- Average: 5.491%
- Dependent repos count: 5.67%
proxy.golang.org: github.com/nicovank/energy-languages
- Homepage: https://github.com/nicovank/energy-languages
- Documentation: https://pkg.go.dev/github.com/nicovank/energy-languages#section-documentation
- Licenses: Apache-2.0
- Latest release: (published 3 days ago)
- Last Synced: 2026-01-12T07:09:32.817Z (3 days ago)
- Versions: 0
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.338%
- Average: 5.517%
- Dependent repos count: 5.696%
Dependencies
- @types/node 18.11.9
- @types/node ^18.11.9
- actions/checkout v3 composite
- actions/checkout v3 composite
- autocfg 1.1.0
- cfg-if 1.0.0
- crossbeam-channel 0.5.8
- crossbeam-deque 0.8.3
- crossbeam-epoch 0.9.14
- crossbeam-utils 0.8.15
- either 1.8.1
- hermit-abi 0.2.6
- libc 0.2.141
- memoffset 0.8.0
- num_cpus 1.15.0
- rayon 1.7.0
- rayon-core 1.11.0
- scopeguard 1.1.0
- typed-arena 2.0.2
- autocfg 1.1.0
- cfg-if 1.0.0
- crossbeam-channel 0.5.8
- crossbeam-deque 0.8.3
- crossbeam-epoch 0.9.14
- crossbeam-utils 0.8.15
- either 1.8.1
- hermit-abi 0.2.6
- libc 0.2.141
- memoffset 0.8.0
- num_cpus 1.15.0
- rayon 1.7.0
- rayon-core 1.11.0
- scopeguard 1.1.0
- hermit-abi 0.2.6
- libc 0.2.141
- num_cpus 1.15.0
- aho-corasick 0.7.20
- memchr 2.5.0
- regex 1.7.3
- regex-syntax 0.6.29
- autocfg 1.1.0
- cfg-if 1.0.0
- crossbeam-channel 0.5.8
- crossbeam-deque 0.8.3
- crossbeam-epoch 0.9.14
- crossbeam-utils 0.8.15
- either 1.8.1
- hermit-abi 0.2.6
- libc 0.2.141
- memoffset 0.8.0
- num_cpus 1.15.0
- rayon 1.7.0
- rayon-core 1.11.0
- scopeguard 1.1.0
- autocfg 1.1.0
- cfg-if 1.0.0
- crossbeam-channel 0.5.8
- crossbeam-deque 0.8.3
- crossbeam-epoch 0.9.14
- crossbeam-utils 0.8.15
- either 1.8.1
- hermit-abi 0.2.6
- libc 0.2.141
- memoffset 0.8.0
- num_cpus 1.15.0
- rayon 1.7.0
- rayon-core 1.11.0
- scopeguard 1.1.0
- @types/node 18.16.1
- @types/node 18.16.1
- actions/checkout v4 composite
- gmpy2 ==2.1.5
- black ==24.4.2
- matplotlib ==3.9.0
- mypy ==1.10.0
- numpy ==1.26.4
- pandas ==2.2.2
- pandas-stubs ==2.2.2.240514
- rich ==13.7.1
- scipy ==1.13.1
Score: -Infinity