Return-Path: X-Original-To: apmail-apr-dev-archive@www.apache.org Delivered-To: apmail-apr-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7CAB9113C1 for ; Thu, 10 Jul 2014 19:57:55 +0000 (UTC) Received: (qmail 77382 invoked by uid 500); 10 Jul 2014 19:57:55 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 77302 invoked by uid 500); 10 Jul 2014 19:57:55 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 77292 invoked by uid 99); 10 Jul 2014 19:57:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jul 2014 19:57:55 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: 76.96.59.212 is neither permitted nor denied by domain of jim@jagunet.com) Received: from [76.96.59.212] (HELO qmta14.westchester.pa.mail.comcast.net) (76.96.59.212) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jul 2014 19:57:48 +0000 Received: from omta10.westchester.pa.mail.comcast.net ([76.96.62.28]) by qmta14.westchester.pa.mail.comcast.net with comcast id Qj2s1o0080cZkys5EjxTEC; Thu, 10 Jul 2014 19:57:27 +0000 Received: from jimsys.jagunet.com ([209.133.192.10]) by omta10.westchester.pa.mail.comcast.net with comcast id QjvF1o00h0Dv88p3WjvKUR; Thu, 10 Jul 2014 19:55:25 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: Skiplist improvements From: Jim Jagielski In-Reply-To: Date: Thu, 10 Jul 2014 15:55:10 -0400 Cc: apr Content-Transfer-Encoding: 7bit Message-Id: <257A1897-4A9D-41F8-B6C6-C49A296DA919@jaguNET.com> References: To: Yann Ylavic X-Mailer: Apple Mail (2.1878.6) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1405022247; bh=iF7Mtj8mOxFDBaCG7leiw99WMSIXPsv2JIXKclfGbZ4=; h=Received:Received:Content-Type:Mime-Version:Subject:From:Date: Message-Id:To; b=n6SHlA06F1U8CzX1Qi96yNdxdMfQp2Fllh9wOhhxptKhUVpVJpukvaGkrAUxmqRNa 2bDkko4pB/lDTIvLHLrelCo/WUQWBW1CXWLkI07xSuRajmamMn6/4Gi1NsZI60an2T nQYAufOPSa+opcOppcADm+iD/4f2N4pvbWy45C2gI4K2WzCc6giQ+h1+WGkGS5/ff1 mMFbsqphKSSwme3E4VbSotI1bw68L9uJhxLhGvT1r2RQ4v1zbSGjlVf3/AXvOM9KiU C/wi17eSjCjimjHRotjsPK6XrlvosjH6J2DyThMY4EXRkgs+6TuyMAbqqvFsRHuMk2 Z5nYl1x1M6Rkg== X-Virus-Checked: Checked by ClamAV on apache.org On Jul 10, 2014, at 1:53 PM, Yann Ylavic wrote: > Hello, > > while trying to play with skiplists and multiple identical values > (doublons, inserted with apr_skiplist_add), I have faced several > issues. > > The doublons compare equally but do not necessarily contain the same > object, hence I had hoped that doublons added last would have been > inserted last (this is the case, apr_skiplist_pop() works as > expected), and that apr_skiplist_find() would have returned the first > (oldest, FIFO) or last (newest, LIFO) all the time (this is not the > case). > > The issue is that when a doublon is insert_compare()d, it will not > necessarily (and even unlikely) be at the same height as the existing > doublon(s). > Hence a "skip path" may be created between any previous value and the > new doublon just inserted, and that path may be taken by > apr_skiplist_find() to skip the oldest doublon(s). > > I think this is not a desirable behaviour (the internals are > probabilistic but the returned values through the API shouldn't be :p > ). > What does the canonical description of skiplists say? Is that desirable or expected behavior? What do other skiplist implementations do?