Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joelibaceta/php-c-extension-demo
An extension for PHP written in c to demonstrate the performance improvements in the numerical calculation.
https://github.com/joelibaceta/php-c-extension-demo
c-extension miller-rabin php
Last synced: 4 days ago
JSON representation
An extension for PHP written in c to demonstrate the performance improvements in the numerical calculation.
- Host: GitHub
- URL: https://github.com/joelibaceta/php-c-extension-demo
- Owner: joelibaceta
- Created: 2019-04-27T09:20:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-04-28T04:42:57.000Z (over 5 years ago)
- Last Synced: 2024-12-21T05:26:35.801Z (13 days ago)
- Topics: c-extension, miller-rabin, php
- Language: C
- Size: 3.35 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## PHP C Extension Demo
A performance approach
Primes generation is a clasic mathematical problem which needs to develop increasingly optimal algorithms to solve it, in this case we choose miller-rabin algorithm.
> [**Miller-Rabin**](https://en.wikipedia.org/wiki/Miller–Rabin_primality_test) is a probabilistic approch to determine if a number is prime or not similar to the Fermat Primality test.
The following demo, show us this algoritm trying to find first 5000 primes with 12 digits using PHP pure implementation and another using a C extension for the calculation process.
![screen](images/screen_record.gif)
As we can see, using a c-extension for the primality test we get a 2927x faster execution.