Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkXcg-00014e-GS for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Dec 2020 19:17:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kkXcf-00008j-Al for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Dec 2020 19:17:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1kkXcf-00008c-1x for pgsql-hackers@lists.postgresql.org; Wed, 02 Dec 2020 19:17:05 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1kkXcc-0004EG-Kx for pgsql-hackers@postgresql.org; Wed, 02 Dec 2020 19:17:03 +0000 Received: by mail-wm1-x343.google.com with SMTP id c198so10475305wmd.0 for ; Wed, 02 Dec 2020 11:17:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=CX4hFRoDX+cZKJCYn1tTBKcOu5v5N392CQjbHfT1Dc0=; b=YnreSzI5fUHgH2Z6cVl6P1TZLmxE18ePKjJynyPojBH0RLQGAKDScMQcx3Ma8ziAj9 utDSXwl75cAHPEUX/1xV95acqf8dWWAbz294GPjRBp8M7Hj9bA0OHAVRz0rskouXxZAV eUFJBZtLGB5ngHArMM9iM0TJkqAnHbbozQFsBjfU3/cTlHJ4fBoRS1zhlPA1ExuZU4KH xSu8pk5gaGcPTl4WkN5pMo3R36emsuve7G9TAhpyuezJYZvsEpq/mMzZA/Fd2C4E5OFb FKxT0alJjfAwprEAMbsdd6+qE/BIrBqJgsbgqJl6W1ZkRIIELMXVaTHzxArdINQmyYF0 +tGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CX4hFRoDX+cZKJCYn1tTBKcOu5v5N392CQjbHfT1Dc0=; b=Cpzipbel+sizbTzXvCrEzde7mK++KdWMoog/qa0y6P+WGmp6NGvwBLNqNmvnBOBI3O qDmG8SVRLqvIIXBrsxAJQcU5vmpWAbM3cPaTBrzCdxCUB0OPEWve0TR74ckJTUc1TCDd 0VJlbS/WXXC1JgxLs5ZylNxZKbWIW83/ZX9qFizJEoI0aB0im/2tPq3QHZ5gCqIngkVO 8sTsTbDf2hdn7Ah7ylQpOFZmA94PixO0tjgXxAXHfHbFO6I/L5TGgrklamCj4aaddRUV PAjDfMPTqMlsOm0uMRhqmpO6zhx46PW8TwbegdLx5Qx7jCtyOAleHevT3ADfmqifbKp7 X6Hg== X-Gm-Message-State: AOAM530gcnXgS3IFtYDNOcT/rjrlw3mL6+NWe+9DwYD1AEfY8T51y8Co KGNJjXpfVYuk8OAgTP9DeR4= X-Google-Smtp-Source: ABdhPJxtQmHzeLD8joEIzeoTsX+rJNguZfZqAFzpKtqHffWyHq6OyoQfJGdV4uzCzR3bL03Cs5Bh/g== X-Received: by 2002:a1c:208f:: with SMTP id g137mr4495627wmg.67.1606936619916; Wed, 02 Dec 2020 11:16:59 -0800 (PST) Received: from localhost (dslb-094-222-016-204.094.222.pools.vodafone-ip.de. [94.222.16.204]) by smtp.gmail.com with ESMTPSA id y2sm3095071wma.6.2020.12.02.11.16.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Dec 2020 11:16:59 -0800 (PST) Date: Wed, 2 Dec 2020 20:18:08 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Tom Lane Cc: Alexander Korotkov , Pavel Stehule , Justin Pryzby , David Steele , Nikita Glukhov , Alvaro Herrera , David Fetter , Thomas Munro , Oleksandr Shulgin , Robert Haas , Andres Freund , Michael Paquier , Oleg Bartunov , Peter Eisentraut , PostgreSQL Hackers Subject: Re: [HACKERS] [PATCH] Generic type subscripting Message-ID: <20201202191808.kdnwzgc5kattfro3@localhost> References: <20200920154652.etzmrphoe3hiod7t@localhost> <20200928093631.obnmgllx3ihhjvsd@localhost> <20201130113454.ohb6oho4fvwtpz3t@localhost> <20201130132619.zzgl272m5rcnhvzt@localhost> <20201202145958.mkkxqmn7jeik6yem@localhost> <1651995.1606931931@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1651995.1606931931@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Wed, Dec 02, 2020 at 12:58:51PM -0500, Tom Lane wrote: > So ... one of the things that's been worrying me about this patch > from day one is whether it would create a noticeable performance > penalty for existing use-cases. I did a small amount of experimentation > about that with the v35 patchset, and it didn't take long at all to > find that this: > > --- cut --- > create or replace function arraytest(n int) returns void as > $$ > declare > a int[]; > begin > a := array[1, 1]; > for i in 3..n loop > a[i] := a[i-1] - a[i-2]; > end loop; > end; > $$ > language plpgsql stable; > > \timing on > > select arraytest(10000000); > --- cut --- > > is about 15% slower with the patch than with HEAD. I'm not sure > what an acceptable penalty might be, but 15% is certainly not it. > > I'm also not quite sure where the cost is going. It looks like > 0001+0002 aren't doing much to the executor except introducing > one level of subroutine call, which doesn't seem like it'd account > for that. I've tried to reproduce that, but get ~2-4% slowdown (with a pinned backend, no turbo etc). Are there any special steps I've probably missed? At the same time, I remember had conducted this sort of tests before when you and others raised the performance degradation question and the main part of the patch was already more or less stable. From what I remember the numbers back then were also rather small.