On Fri, Nov 28, 2014 at 5:39 PM, Patrick Schaaf <p...@bof.de> wrote:

>
> Am 28.11.2014 15:46 schrieb "Ferenc Kovacs" <tyr...@gmail.com>:
> >
> > from a quick test using spl_object_hash seems to be the slower with big
> number of elements in haystack.
>
> Your test only does the is-it-known test once. For an already-visited-set
> use case the test will run once for each visited element, and will usually
> fail, too, thus running the whole already built haystack at each point from
> front to end with in_array - overall N*(N/2) test + N*simple-array-append
> for the in_array approach, vs. N test + N*spl_object_hash-append.
>
> best regards
>   Patrick
>
you are right, the actual visited set pattern is much more favorable for
the hash lookups.

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

Reply via email to