- C++ 87.1%
- CMake 12.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .circleci | ||
| .github/workflows | ||
| src | ||
| tests | ||
| .gitignore | ||
| CMakeLists.txt | ||
| LICENSE | ||
| README.md | ||
C++ Parallel Factorial
Fast ⚡ implementation of factorial written in 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.