Skip to content

Programming-is-Easy/testcpu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

testcpu

A bunch of separate tests of CPU performance by language - golang, c, php, js, and python (lol).

Compile Everything

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 Usage:

$ go run langs/go/main.go

image

C Usage:

$ chmod +x make.sh
$ ./make.sh
$ ./testcpu

image

Python Usage:

$ python3 langs/python/testcpu.py

image

Node Usage:

$ node langs/js/testcpu.js

image

Bun Usage:

$ bun langs/js/testcpu.js

image

PHP Usage:

This one sucks.

  1. First go recompile PHP to have threads: https://stackoverflow.com/questions/67246761/how-to-compile-install-official-php-8-with-zts-ubuntu
  2. Install parallel: https://github.com/krakjoe/parallel
  3. Fight with your PHP config until it works:
    1. Make sure you have a PHP ini set in your cli: php --ini
    1. If not, find your PHP ini somewhere on your computer and put it into whatever Path php --ini says it's looking for.
    1. Then edit that ini file and make sure you add extension=/path/to/parallel.so
  1. Profit?
$ php langs/php/testcpu.php

image

Additional Languages or Concepts

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.

Original X writeup:

https://x.com/blister/status/1873054737681305828

I'm Eric Harrison!

Follow me if you want: https://x.com/blister

About

A bunch of separate tests of CPU performance by language - golang, c, php, js, and python (lol). from: https://x.com/blister/status/1873054737681305828

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published