Return-Path: X-Original-To: apmail-subversion-dev-archive@minotaur.apache.org Delivered-To: apmail-subversion-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 194AE17E99 for ; Sat, 5 Sep 2015 16:23:58 +0000 (UTC) Received: (qmail 26839 invoked by uid 500); 5 Sep 2015 16:23:57 -0000 Delivered-To: apmail-subversion-dev-archive@subversion.apache.org Received: (qmail 26785 invoked by uid 500); 5 Sep 2015 16:23:57 -0000 Mailing-List: contact dev-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@subversion.apache.org Received: (qmail 26775 invoked by uid 99); 5 Sep 2015 16:23:57 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Sep 2015 16:23:57 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 306001AB6E5 for ; Sat, 5 Sep 2015 16:23:57 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.121 X-Spam-Level: X-Spam-Status: No, score=-0.121 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=wandisco.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id UnddVV9sDZCk for ; Sat, 5 Sep 2015 16:23:55 +0000 (UTC) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 2253320489 for ; Sat, 5 Sep 2015 16:23:55 +0000 (UTC) Received: by wicge5 with SMTP id ge5so44022160wic.0 for ; Sat, 05 Sep 2015 09:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wandisco.com; s=gapps; h=subject:to:references:from:organization:message-id:date:user-agent :mime-version:in-reply-to:content-type; bh=H9Y37Tg/aB9o79PeDFr3gY6fbbGJev+LChngtHiScU8=; b=A68Yze3oT8DbB/y7cWn7qVX2axiAXlhgM39y3a9WBuUWQ54D00GRIpby6E+ftIlsc0 +1zmexYVZXAT11bdGB8Enujt7MuVJCFV+gLR78rPX/dv/vS0t/FVGmduPf33+TzfUgk6 nAPjAetHlg4+jlOnN9OYEw7D5+6rMne7W3qIs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to:content-type; bh=H9Y37Tg/aB9o79PeDFr3gY6fbbGJev+LChngtHiScU8=; b=hca3WBD31Nb4Z4QseBa43Axi+BOJoFaON+QcY1YCpy3g04H2z0UwXkQdzqgr00BlH+ MUTq3MMTP4C0YXrC2I2fNJhwFwuYnDg6WtBWWOY0pdMBF2xeioV3A4lUr3YUHrR3XJCm 9kBpcp//ROTDRNqkwF/DRhqnoYoJeMXJzIxt02TMSKpnth62pgQmQw3glQSmukSc1LCp zq1LCp5a5YBKgnnlulL7Smo1R3Ie2hGzIoCdhBTc0zPM/01bio0tE5l1v/IPiKAfFw7M ht+XiClpSWe+WxbmGX/9C6FiIw5y3yHMefPjYwML2pV8tt67JnwqN2T241bbPi2ANVC+ HUzQ== X-Gm-Message-State: ALoCoQkYf7mieKECZsW0wyYa+Zd7T1NAUWyU7o3FiZqo92Stn5X8OfCUxhZPZ0Tgqmc0c8QFAZks X-Received: by 10.180.182.107 with SMTP id ed11mr18281618wic.52.1441470227785; Sat, 05 Sep 2015 09:23:47 -0700 (PDT) Received: from zulu.23.e-reka.si (cpe-46-164-0-113.dynamic.amis.net. [46.164.0.113]) by smtp.gmail.com with ESMTPSA id i3sm10638182wja.42.2015.09.05.09.23.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 05 Sep 2015 09:23:46 -0700 (PDT) Received: from zulu.23.e-reka.si (localhost [127.0.0.1]) by zulu.23.e-reka.si (Postfix) with ESMTP id 361F2F9588C8 for ; Sat, 5 Sep 2015 18:23:45 +0200 (CEST) Subject: Re: svn commit: r1701317 - in /subversion/trunk/subversion: include/private/svn_ra_svn_private.h libsvn_ra_svn/marshal.c To: dev@subversion.apache.org References: <20150904191745.534A2AC0232@hades.apache.org> <55EA3D0E.3000009@wandisco.com> From: =?UTF-8?Q?Branko_=c4=8cibej?= Organization: WANdisco Message-ID: <55EB1711.9070809@wandisco.com> Date: Sat, 5 Sep 2015 18:23:45 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <55EA3D0E.3000009@wandisco.com> Content-Type: multipart/mixed; boundary="------------070402030801090102070202" This is a multi-part message in MIME format. --------------070402030801090102070202 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 05.09.2015 02:53, Branko Čibej wrote: > On 04.09.2015 21:17, stefan2@apache.org wrote: >> Author: stefan2 >> Date: Fri Sep 4 19:17:44 2015 >> New Revision: 1701317 >> >> URL: http://svn.apache.org/r1701317 >> Log: >> Finally, make svn_ra_svn__list_t actually a fully typed, ra_svn-specific >> object. Update the creation functions; everything else already "just fits". > How is this code different from using APR arrays, except that the latter > needs a typecast on array item access? As far as I can see, you've > completely duplicated the APR array allocation strategy, including using > two allocations to create the array. > > The only significant difference is that capacity is being tracked > outside the svn_ra_svn__list_t structure during the construction of the > list. > > Call me dense ... but can you please explain how exactly is this > better/faster than using APR arrays? (I'm not going to mention 'safer' > because it clearly isn't.) Code like this that is apparently meant be an > optimisation of something(?) really should have a bit of an explanatory > comment, IMO. I played around with the apr_array_make implementation a bit and did some performance measurements with small array allocation and usage, with the following pattern: * in 60% of cases, the array does not get resized * in 30% it gets resized once * in 10% it gets resized twice If I change apr_array_make to allocate the initial number of elements in the same block as the array header, I get a 15% speedup on this test case, compared to the default implementation. If I change it further to never set the element values to 0 in apr_array_make, I get an additional 10% speedup, for a total of 23%. So I'm guessing this is the number you were actually seeing. We can certainly change APR to get that extra 15% in, but we can't remove the memset(0) because it's part of the existing API semantics. However we can add (in apr-1.6 and 2.0) a new constructor, e.g. apr_array_make_uninitialized, that would not clear the element values. This wouldn't help with apr_array_push, but note that there's already a private function called apr_array_push_noclear that's used with apr_table_t Obviously I'd much rather make these enhancements in APR than have yet another custom allocation hack in Subversion. -- Brane --------------070402030801090102070202 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="test-array-alloc.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test-array-alloc.c" I2luY2x1ZGUgPHN0ZGxpYi5oPgoKI2luY2x1ZGUgImFwcl9wb29scy5oIgojaW5jbHVkZSAi YXByX3RhYmxlcy5oIgoKc3RhdGljIHZvaWQKdGVzdF9hcnJheV9hbGxvYyhhcHJfcG9vbF90 ICpwb29sKQp7CiAgICBpbnQgaSwgaiwgazsKICAgIGZvciAoaSA9IDA7IGkgPCA1MDAwMDsg KytpKQogICAgewogICAgICAgIGFwcl9wb29sX2NsZWFyKHBvb2wpOwogICAgICAgIGZvciAo aiA9IDA7IGogPCAxMDAwMDsgKytqKQogICAgICAgIHsKICAgICAgICAgICAgY29uc3QgaW50 IG5lbHRzID0gKChqICUgMTAgPT0gMCkgPyAxMQogICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgOiAoaiAlIDEwIDwgNykgPyAzIDogNyk7CiAgICAgICAgICAgIGFwcl9hcnJheV9o ZWFkZXJfdCAqYSA9IGFwcl9hcnJheV9tYWtlKHBvb2wsIDQsIDEpOwogICAgICAgICAgICBm b3IgKGsgPSAwOyBrIDwgbmVsdHM7ICsraykKICAgICAgICAgICAgICAgIEFQUl9BUlJBWV9Q VVNIKGEsIGNoYXIpID0gJ1wwJzsKICAgICAgICB9CiAgICB9Cn0KCmludCBtYWluKHZvaWQp CnsKICAgIGFwcl9wb29sX3QgKnBvb2wgPSBOVUxMOwoKICAgIGlmIChhcHJfaW5pdGlhbGl6 ZSgpKQogICAgICAgIGV4aXQoMSk7CiAgICBhdGV4aXQoYXByX3Rlcm1pbmF0ZSk7CgogICAg YXByX3Bvb2xfY3JlYXRlKCZwb29sLCBOVUxMKTsKICAgIHRlc3RfYXJyYXlfYWxsb2MocG9v bCk7CiAgICByZXR1cm4gMDsKfQo= --------------070402030801090102070202--