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
languages clbg compilers zig clang pending gcc transforms archiving measur
Last synced: about 8 hours 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 (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-03-24T09:08:52.000Z (about 1 month ago)
- Last Synced: 2025-04-25T14:43:50.456Z (2 days ago)
- Language: C
- Homepage:
- Size: 48.6 MB
- Stars: 12
- Watchers: 2
- 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
- Push event: 17
Last Year
- Watch event: 7
- Push event: 17
Committers metadata
Last synced: 7 days ago
Total Commits: 636
Total Committers: 13
Avg Commits per committer: 48.923
Development Distribution Score (DDS): 0.11
Commits in past year: 189
Committers in past year: 3
Avg Commits per committer in past year: 63.0
Development Distribution Score (DDS) in past year: 0.011
Name | Commits | |
---|---|---|
Nicolas van Kempen | n****p@g****m | 566 |
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 |
Ben Albrecht | b****t | 1 |
Felipe Móz | 6****z | 1 |
José Nuno Macedo | j****o@i****t | 1 |
Logan Kilpatrick | 2****3@g****m | 1 |
michaljroszak | 4****k | 1 |
Committer domains:
- inesctec.pt: 1
- di.uminho.pt: 1
- obelix96.cs.umass.edu: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 9
Total pull requests: 78
Average time to close issues: 3 months
Average time to close pull requests: 2 days
Total issue authors: 1
Total pull request authors: 4
Average comments per issue: 0.78
Average comments per pull request: 0.37
Merged pull request: 71
Bot issues: 0
Bot pull requests: 15
Past year issues: 0
Past year pull requests: 5
Past year average time to close issues: N/A
Past year average time to close pull requests: 9 days
Past year issue authors: 0
Past year pull request authors: 2
Past year average comments per issue: 0
Past year average comments per pull request: 1.4
Past year merged pull request: 4
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- nicovank (9)
Top Pull Request Authors
- nicovank (38)
- dependabot[bot] (15)
- hyukjekwon (14)
- dungwinux (11)
Top Issue Labels
Top Pull Request Labels
- dependencies (15)
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: 5.049856007249537