Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 131839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:10:06+00:00 2026-05-11T06:10:06+00:00

Most of my application is written in PHP ((Front and Back ends). There is

  • 0

Most of my application is written in PHP ((Front and Back ends). There is a part that works too slowly and I will need to rewrite it, probably not in PHP. What will give me the following:
1. Most speed
2. Fastest development
3. Easily maintained.

I have in my mind to rewrite this piece of code in CPP as a PHP extension, but may be I am locked on this solution and misses some simpler/better solutions?

The algorithm is PorterStemmerAlgorithm on several MB of data each time it is run.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T06:10:07+00:00Added an answer on May 11, 2026 at 6:10 am

    The answer really depends on what kind of process it is.

    If it is a long running process (at least seconds) then perhaps an external program written in C++ would be super easy. It would not have the complexities of a PHP extension and it’s stability would not affect PHP/apache. You could communicate over pipes, shared memory, or the sort…

    If it is a short running process (measured in ms) then you will most likely need to write a PHP extension. That would allow it to be invoked VERY fast with almost no per-call overhead.

    Another possibility is a custom server which listens on a Unix Domain Socket and will quickly respond to PHP when PHP asks for information. Then your per-call overhead is basically creating a socket (not bad). The server could be in any language (c, c++, python, erlang, etc…), and the client could be a 50 line PHP class that uses the socket_*() functions.


    A lot of information needs evaluated before making this decision. PHP does not typically show slowdowns until you get into really tight loops or thousands of repeated function calls. In other words, the overhead of the HTTP request and network delays usually make PHP delays insignificant (unless the above applies)

    • Perhaps there is a better way to write it in PHP?
    • Are you database bound?
    • Is it CPU bound, Network bound, or IO bound?
    • Can the result be cached?
    • Does a library already exist which will do the heavy lifting.

    By committing to a custom PHP extension, you add significantly to the base of knowledge required to maintain it (even above C++). But it is a great option when necessary.

    Feel free to update your question with more details, and I’m sure Stack Overflow will be happy to help out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a console application written in Free Pascal, that like most larger applications
I have a web-application written in CodeIgniter, and for the most part everything seems
Hi Consider a somewhat process consuming PHP application that works heavily with complex DB
the system I'm working with consists of: A front-end application written in most likely
I've written (most of) an application in Flex and I am concerned with protecting
Most of the literature on Virtual Memory point out that the as a Application
I am working on an application that detects the most prominent rectangle in an
The web application has following prerequisites: Written in PHP Several menues, also a hierarchy
Prerequisite: There is client/server application written in Delphi32. The RDBMS is SQL Server 2005.
I have a web application written in PHP. It uses MySQL for data storage.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.