Fast C++ Parallel Factorial
  • C++ 87.1%
  • CMake 12.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2022-09-21 20:00:21 +01:00
.circleci chore(ci): infer now analyses files correctly 2022-02-12 00:22:55 +00:00
.github/workflows chore(ci): don't run CodeQL on pr (#10) 2022-02-12 01:00:52 +00:00
src chore(docs): add code quality badge to readme (#6) 2022-02-11 04:25:45 +00:00
tests fix: refactor and add tests 2022-02-10 23:11:48 +00:00
.gitignore fix(meta): remove nix from the project (#4) 2022-02-11 03:16:37 +00:00
CMakeLists.txt refactor and add tests 2022-02-10 03:59:26 +00:00
LICENSE Create LICENSE (#11) 2022-09-21 20:00:21 +01:00
README.md chore(docs): remove nix instructions and add test instructions (#7) 2022-02-12 00:52:05 +00:00

C++ Parallel Factorial

Fast implementation of factorial written in C++.

CircleCI Language grade: C/C++

I wrote this just to see what writing concurrent/parallel code is like in C++ and was pleasantly surprised compared to how awkward pthreads are in C. My experience with Rust and Rayon has still been significantly better.

Putting this out there just because, I wouldn't use this anywhere important though. It's probably riddled with bugs and the code quality is terrible, this being one of the first things I've ever written in C++ that kind of works.

Build

Required libraries and tools:

  • clang
  • cmake
  • ninja
  • gmp

Once these dependencies are satisfied, you can build by running:

$ mkdir release && cd release
$ cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release
$ ninja

and you can then run the resulting executable.

Test

To run the unit tests, build with the instructions above, then run the cpp-parallel-factorial binary in the tests folder.

How to Use

$ ./parallel-factorial <NUMBER>

The output will be written to stdout.