Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79283 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64419 invoked from network); 28 Nov 2014 17:16:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2014 17:16:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.178 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.214.178 mail-ob0-f178.google.com Received: from [209.85.214.178] ([209.85.214.178:60170] helo=mail-ob0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/30-59154-AEDA8745 for ; Fri, 28 Nov 2014 12:16:26 -0500 Received: by mail-ob0-f178.google.com with SMTP id gq1so5318363obb.9 for ; Fri, 28 Nov 2014 09:16:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=RwpFC04Q00g+TewFnporBRZdNqTo5xhR9X5SxS7l+uc=; b=TKuzCsyyBH2sCvxqJnJrKOHdqDkk5263ITZFfrL2fHKv2x8peAy0XZUeRo5Z7CDesG azUDKe7YZqPbzNy9GL1w+PXFNkedJMyLy5bav3BxK31rtQ+lfAn/e+aNX7st8vEzKHaM oGe5pMxiYk+C9P/Wt1FdOPjT+ThhuMtwtSBfwEkp9rz/Tnhh586owjcZ1mfhPsv5YHVd 4q+b7bN0egW4gG4L+N1hskt6L2poTnRrWc5ou5XAJDpz+syu77tbL0HaK0YV3lPY60Bh tf/Esig03lza5bQOxnED8S3Om2dt8YlxReGXskF1qmSm9sqTjHwJ6mnMG1zBl65dSTzD qWbA== MIME-Version: 1.0 X-Received: by 10.60.115.227 with SMTP id jr3mr27930678oeb.33.1417194983296; Fri, 28 Nov 2014 09:16:23 -0800 (PST) Received: by 10.60.37.103 with HTTP; Fri, 28 Nov 2014 09:16:23 -0800 (PST) In-Reply-To: References: <9846323.EvUROnfLfe@rofl> Date: Fri, 28 Nov 2014 18:16:23 +0100 Message-ID: To: Patrick Schaaf Cc: Sebastian Krebs , internals , Bostjan Skufca Content-Type: multipart/alternative; boundary=089e011842428e99650508ee6b60 Subject: Re: [PHP-DEV] New function: spl_object_id() or spl_object_handle() From: tyra3l@gmail.com (Ferenc Kovacs) --089e011842428e99650508ee6b60 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Nov 28, 2014 at 5:39 PM, Patrick Schaaf wrote: > > Am 28.11.2014 15:46 schrieb "Ferenc Kovacs" : > > > > 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 usuall= y > fail, too, thus running the whole already built haystack at each point fr= om > 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. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --089e011842428e99650508ee6b60--