[Xapian-devel] PHP Latest

Olly Betts olly at survex.com
Fri Apr 21 17:22:57 BST 2006


On Fri, Apr 21, 2006 at 01:15:15PM +0200, Daniel M?nard wrote:
> Sam's suggestion was good : I tested 100000 calls to 
> QueryParser::parse_query with versions 7 and 8 of the wrapper.
> 
> Version 7 : 3.28 sec
> Version 8 : 2.64 sec.
> (For comparison, calling directly 
> "queryparser_parse_query($parser->swig_ptr,'word');" : 0.96 sec.)

That's still quite a difference, but I don't really see how we can do
better.  And in reality there would be a lot more PHP code between
calls.

Plus the user has the option to drop back to the flat function interface
if the overhead ever does matter.  I suspect it only might for
Document_addposting and in that case the disk I/O speed for writing out
the database blocks is probably the limiting factor anyway.

> >TODO: Profile to see if switch is slower than "if ... else ..."
> 
> If I rewrite parse_query with an 'if' in version 8 of the wrapper, I 
> don't measure any difference (exec time=2.64 sec).

Thanks for checking.  I'll stick with the "switch" then, since it
requires less special casing.

> Exec times I obtained are :
> - 0.9.4 release version : 8.84 8.96 9.00 9.01 8.81 8.84 8.80 8.83
> - 0.9.4 with xapian_wrap8.cc, commenting all lines wich reference 
> 'set_sort_by_relevance_then_value' : 9.51 9.49 9.53 9.52 9.51
> - 0.9.5 release version : 8.81 8.87 8.85 8.85 8.86
> - 0.9.5 with xapian_wrap8.cc : 9.38 9.40 9.38 9.33 9.36 9.34
> 
> The difference is not very important, but it exists. Is there something 
> I can do to investigate anymore ?

The odd thing is that the code differences between 0.9.5 and
xapian_wrap8.cc are tiny.

But I notice that if we call our resource pointer "$_cPtr" instead of
"$swig_ptr" we can avoid the special case code entirely.  There's also
some useless dead code in the active path (there's a pending patch I've
submitted to SWIG to clean that up).

Can you try this pair:

http://www.oligarchy.co.uk/xapian/patches/xapian_wrap8b.cc
http://www.oligarchy.co.uk/xapian/patches/xapian8b.phps

Just try them together and we can compare the timings with those above.
I'm hoping they'll actually be a little faster than the 0.9.4 and 0.9.5
releases.

Cheers,
    Olly



More information about the Xapian-devel mailing list