A bunch of separate tests of CPU performance by language - golang, c, php, js, and python (lol).
Make.sh is a simple script that will compile all the compilables
and dump them into bin/
.
$ chmod +x make.sh
$ ./make.sh
$ cd bin/
$ go run langs/go/main.go
$ chmod +x make.sh
$ ./make.sh
$ ./testcpu
$ python3 langs/python/testcpu.py
$ node langs/js/testcpu.js
$ bun langs/js/testcpu.js
This one sucks.
- First go recompile PHP to have threads: https://stackoverflow.com/questions/67246761/how-to-compile-install-official-php-8-with-zts-ubuntu
- Install parallel: https://github.com/krakjoe/parallel
- Fight with your PHP config until it works:
-
- Make sure you have a PHP ini set in your cli:
php --ini
- Make sure you have a PHP ini set in your cli:
-
- If not, find your PHP ini somewhere on your computer and put it into whatever Path
php --ini
says it's looking for.
- If not, find your PHP ini somewhere on your computer and put it into whatever Path
-
- Then edit that ini file and make sure you add
extension=/path/to/parallel.so
- Then edit that ini file and make sure you add
- Profit?
$ php langs/php/testcpu.php
Feel free to submit a PR if you want to add a new language or point out some flaw in how I implemented the test in the versions that I've created. This isn't a "serious" benchmark, but if there's a better way to do something in a language in this repo, it'd be nice to see how that compares to the versions I've written.
https://x.com/blister/status/1873054737681305828
Follow me if you want: https://x.com/blister