What I do for python is generate C++ code and put cython bindings around it, much faster. (over10x) You could do the same thing for PHP by writing a PHP extension.

Start here:
http://www.php.net/manual/en/internals2.php

You could also try something like Swig which is like an auto bindings generator for many languages.

-Matt

On 17/04/13 20:33, Hassan Chen wrote:
Have any way to improve it ?  Google tell me nothing.


On Wed, Apr 17, 2013 at 4:30 PM, Matthew Chambers <[email protected]>wrote:

Yes, because PHP is an interpreted language.


On 17/04/13 20:27, Hassan Chen wrote:

o(╯□╰)o, about 17999 books. This only a test. In practical applications, I
also transfer the array data like this but not books.
Buy I found when transfer large amounts of data one-time, php is very
slow.
   Can you tell me why?


On Wed, Apr 17, 2013 at 4:20 PM, Matthew Chambers <[email protected]
wrote:
  How much roughly would 829k worth of books cost?  Are you preparing for
people to order the entire amazon library through your interface?


On 17/04/13 20:06, Hassan Chen wrote:

  Hi,
Now I'm using TNonblockingServer.  But I found php is so slow than cpp.

The testing result:

server  client  data size  time
    cpp      php    829K        2m23.110s
    cpp      php    446K        0m33.337s
    cpp      php    199K        0m4.305s
    cpp      cpp     829K       0m0.564s

The service and data struct is:
struct Book {
       1: i32 book_id,
      2: string book_name,
      3: string book_author,
      4: double book_price,
      5: string book_publisher,
      6: i32    age,
}

service BookOrder {
       list<Book> order(1: string book);
}


Now I have some question:
1. Why php is so much slower than cpp
2. As the amount of data increases, the php's performance drastically
reduced

can anyone tell me?

Thanks.
--
Hassan Chen




Reply via email to