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 3CCFD119B8 for ; Fri, 11 Jul 2014 16:30:16 +0000 (UTC) Received: (qmail 58459 invoked by uid 500); 11 Jul 2014 16:30:16 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 58386 invoked by uid 500); 11 Jul 2014 16:30:15 -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 58376 invoked by uid 99); 11 Jul 2014 16:30:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jul 2014 16:30:15 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ylavic.dev@gmail.com designates 209.85.213.179 as permitted sender) Received: from [209.85.213.179] (HELO mail-ig0-f179.google.com) (209.85.213.179) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jul 2014 16:30:13 +0000 Received: by mail-ig0-f179.google.com with SMTP id h18so1174158igc.6 for ; Fri, 11 Jul 2014 09:29:49 -0700 (PDT) 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 :content-type; bh=vtWf9iXD8IkbjEWMVIW3ALJiIdDoYV/JLGIEFqKOTrY=; b=IF8Op04wiOYCBDIIDCArDsPVH75NXGUMEMZHGY2+da2rVn20f4WfRD6fYCEZJrTxGP fu76h0S9PfipMcHSWQsjHMUD7Dnov+/HLlF/QWZXE4Zv7z3NTMD43zz6vvkiJmT1eaa8 nthZvzVAo2NO3ZxLjKJ5UL/wads1Uo5pR+BGypERWHE8rmyBGp9jsHJ69esiOCsLecdZ Cw4FX848D/+Td4jArWEBFtzfVow+EjrgLkv5UseyEuOmqVaWdNyxTr3zQSSxCF5HXlnt CvtZAQPqPlLkqLDZTw0HWNDrJDQoxOXqEKtedhD2sEiNfJtFpYzopTCpQe66EXoQkCz4 IuPw== MIME-Version: 1.0 X-Received: by 10.50.30.228 with SMTP id v4mr5920440igh.26.1405096189064; Fri, 11 Jul 2014 09:29:49 -0700 (PDT) Received: by 10.42.28.2 with HTTP; Fri, 11 Jul 2014 09:29:48 -0700 (PDT) In-Reply-To: References: <581E0F48-0128-4B06-98EC-11D49DB5E507@jaguNET.com> <4E51F5E9-FA7B-40D4-A23D-A4B4B7F56C22@jaguNET.com> Date: Fri, 11 Jul 2014 18:29:48 +0200 Message-ID: Subject: Re: Skiplist improvements From: Yann Ylavic To: apr Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org Grr, off the list... On Fri, Jul 11, 2014 at 6:29 PM, Yann Ylavic wrote: > On Fri, Jul 11, 2014 at 6:24 PM, Yann Ylavic wrote: >> On Fri, Jul 11, 2014 at 4:28 PM, Jim Jagielski wrote: >>> >>> On Jul 10, 2014, at 8:07 PM, Yann Ylavic wrote: >>> >>>> >>>> I propose to garantee the ordering presumably at low coding and >>>> performance (if any) cost, so that one can choose between apr_table or >>>> apr_skiplist to do similar things (iterate over all the values of a >>>> key is one such thing, in a deterministic order is an other, both not >>>> feasible with the current skiplist implementation). >>>> >>> >>> ++1... For me, performance is key. Or, at least, some sort >>> of option to allow for a skiplist to be created that >>> guarantees order or not, depending on whether performance >>> or ordering is more important. >>> >>> After all, the intent of skiplist *is* in performance, >>> and not ordering, so sacrificing performance for ordering >>> seems kinda wonky, unless one can turn that off :) >> >> I think I can add this option, but in "performance mode", what would >> be the behaviour of : >> 1. apr_skiplist_remove(), >> 2. apr_skiplist_remove_first(), apr_skiplist_remove_last() >> 3. apr_skiplist_find_last() >> >> 2. and 3. are introduced by this patch so the can return NULL (or >> ENOTIMPL by changing the declaration) because it makes no sense to use >> them without ordering. >> >> 1. is more tricky, should it remove one single value or all doublons? >> Doublons are a new 1.6 feature, in 1.5 apr_skiplist_remove() had not >> this to handle. Now we have to rule. >> In the case apr_skiplist_remove() should act on a single value, the >> caller would have to loop to remove all the doublons (restarting from >> the top each time). >> In the case apr_skiplist_remove() should act on all doublons, I don't >> think there is an efficient way to do it without ordering (once a >> value is reached, this is not necessarily the first, and we'd have to >> compare both up and down->next until none remain). >> >> In both case we are stuck with non-ordered-remove performances outside >> the insert/add()/pop() scheme. >> Performance for a use case can't apply to all the others (one may not >> need ordering but still remove to be performant). > > Maybe we could also leave skiplist as is and introduce a new type > (skipmap?) that would be ordered and that would take both key and > value as arguments (in the relevant functions)...