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