Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP using c++ extension will be faster?

I'm now building a recommender system(a web site). I want to use the PHP as the script language. The recommender system may do complex matrix computing or something else. Considering the performance,I want to use C++ to do matrix computing or other complex computing. So I need the PHP call C++ function, get the result and do other processing. I know I can use the PHP extension to call C++. My question is do I need to use C++ or just use PHP to do the complex computing? Is using c++ extension faster than pure PHP?

like image 231
jjyao Avatar asked Feb 01 '26 19:02

jjyao


1 Answers

Yes, using a C++ extension for complex calculations will give you a significant speedup over PHP.

Check out these questions for more details to go about doing this:

  • How can I use C++ code to interact with PHP?
  • Extending PHP with C++?
like image 125
John Carter Avatar answered Feb 04 '26 08:02

John Carter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!