Skip to content

An extension for PHP written in c to demonstrate the performance improvements in the numerical calculation.

Notifications You must be signed in to change notification settings

joelibaceta/php-c-extension-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

As we can see, using a c-extension for the primality test we get a 2927x faster execution.

About

An extension for PHP written in c to demonstrate the performance improvements in the numerical calculation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published