Edit report at http://pear.php.net/bugs/bug.php?id=18752&edit=1
ID: 18752
Updated by: [email protected]
Reported By: xavier dot montagutelli at unilim dot fr
Summary: Performance problem retrieving search result + patch
Status: Verified
Type: Feature/Change Request
Package: Net_LDAP2
Operating System: GNU/Linux Debian
Package Version: 2.0.11
PHP Version: 5.3.0
Assigned To: beni
Roadmap Versions:
New Comment:
Confirmed this.
However this would involve an API change.
The better way is surely to cache the call to ldap_count_entries and
return the count from that cache.
I added a fix to count(). Please fetch the latest SVN version (revision
xxx) and verify that your bug is solved now.
Thanks for improving Net_LDAP2!
Previous Comments:
------------------------------------------------------------------------
[2011-08-24 07:24:40] beni
-Status: Open
+Status: Verified
-Assigned To:
+Assigned To: beni
------------------------------------------------------------------------
[2011-08-23 16:46:47] montagut
Added #patch
bug:18752;patch:Search.php-shiftEntry.patch;revision:1314114407;.
------------------------------------------------------------------------
[2011-08-23 16:39:43] montagut
Description:
------------
There's a serious performance problem fetching results from a
search.
When doing a very simple search on a directory with around
50.000 entries, getting the results with the "shiftEntry"
methods takes a very long time, compared to using the native
PHP functions.
With Xdebug, I have identified the bottleneck. Each call to
"shiftEntry" calls "count", and this one calls
"ldap_count_entries". I suppose this function goes
through all the remaining results to give the count, so calling it
inefficient.
It can safely be removed, patch attached
Test script:
---------------
Test script (to run in command line mode) :
https://docs.google.com/leaf?id=0ByWMI5PuRIdwNDU5MDdmMGQtNTdiZC00MTYyLWI3YmQtMzIwZTU0YmQ1YzZj&hl=fr
Actual result:
--------------
1. Using PHP native LDAP functions
Number of entries : 22402
Search time : 2 seconds
Building list from search result : 0 seconds
2. Using Net_LDAP2 object
Number of entries : 22402
Search time : 2 seconds
Building list from search result : 15 seconds
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18752&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.