Hi Ashley,
I'd like to summurize our internal mail-exchange
- At very beginnig PHP was designed to have better perfornmance
than competitive projects like ASP,mod_perl etc.
- CINT was mostly designed to be complient with C++, so
in many cases CINT is not very efficient. The best way to
"comensate" it is using code compiled with ACLiC
To achieve the best performance with Carrot follow simple rules:
0. do not use redirected stdout
http://carrot.cern.ch/CarrotExamples/tutorial/tut0-3.html
1. wherever it's possible use buffered output ( do not use *.chtml files )
http://carrot.cern.ch/CarrotExamples/tutorial/tut0-9.html
2. wherever it's possible compile and use compiled code
http://carrot.cern.ch/CarrotExamples/tutorial/tut0-6.html
3. wherever it's possible use server-side cached scripts
http://carrot.cern.ch/CarrotExamples/tutorial/tut6-1.chtml
compiled and server-side cached pages have the same "efficiency" as static pages
4. use ApacheBench.C script to compare PHP and Carrot generated pages
http://carrot.cern.ch/CarrotExamples/ApacheBench.C
Thanks. Regards. Valeriy
Ashley Cambrell wrote:
>
> (argh, press ctrl+enter [send])
>
> Hi All,
>
> I've converted the index listing "page" of a thread feedback system to
> try and compare PHP and Carrot. It all work more or less successfully,
> but it is a full 5 times slower than PHP. The code hasn't been optimized
> as such, mainly using pass by reference where ever possible. Otherwise
> it's a direct line for line conversion.
>
> eg (elapsed time in milliseconds)
> PHP:
>
> <font face="Arial"><a name="1135"
> href="showPostings.php?first=1135&last=1135&discussionname=CSE3400&article_numbers=100&article_sort_type=desc&article_count_type=articles&article_start=0&type=threaded">Re:
> Copy constructor, Assignment operator, Destructor</a> -
> (Karen)(2002-04-24 11:24:43.192384+10)</font></td></tr>
>
> Elapsed time: 0
> makeThreadedIndex(8): elapsed time: 0
> makeThreadedIndex(7): elapsed time: 0
> makeThreadedIndex(6): elapsed time: 0
> makeThreadedIndex(5): elapsed time: 0
> makeThreadedIndex(4): elapsed time: 0
> makeThreadedIndex(3): elapsed time: 0
> makeThreadedIndex(2): elapsed time: 0
> makeThreadedIndex(1): elapsed time: 0
>
> Carrot:
> <font face="Arial"><a name="1135"
> href="showPostings.php?first=1135&last=1135&discussionname=CSE3400&article_numbers=100&article_sort_type=desc&article_count_type=articles&article_start=0&type=threaded">Re:
> Copy constructor, Assignment operator, Destructor</a> -
> (Karen)(2002-04-24 11:24:43.192384+10)</font></td><td
> bgcolor="#ffffff"><table><tr><td><font
> face="Arial"></font></td></tr></table></td></tr>
> makeIndexEntry elapsed: 8
> makeThreadedIndex(8): elapsed time: 4
> makeThreadedIndex(7): elapsed time: 27
> makeThreadedIndex(6): elapsed time: 49
> makeThreadedIndex(5): elapsed time: 72
> makeThreadedIndex(4): elapsed time: 96
> makeThreadedIndex(3): elapsed time: 119
> makeThreadedIndex(2): elapsed time: 142
> makeThreadedIndex(1): elapsed time: 202
>
> makeThreadedIndex is a recursive function that crawls the thread tree.
> The database is a parent <-> child type setup
>
> [number = 2, p_number = NULL]
> --> [number = 5, p_number = 2]
> ----> [number = 8, p_number = 5]
> etc
>
> I have used pass by reference where ever possible for TStrings (TString
> &output).
>
> Is doing doing stacks of:
>
> TString output = "blah blah";
> output += Form("some long string with lots of %s", "data");
>
> inheretly slow? Is there a better way to do it? Or could it be the
> recursion? (Or my code / me ;-) )
>
> Thanks people for all your help.
>
> Ashley Cambrell
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:52 MET