From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#65491: [PATCH] Improve performance allocating vectors Date: Sat, 26 Aug 2023 14:54:55 +0000 Message-ID: <87y1hxj1kw.fsf@localhost> References: <87y1i0iwvu.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9889"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65491@debbugs.gnu.org, Eli Zaretskii , Stefan Monnier To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 26 16:55:15 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qZugz-0002HT-Ta for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Aug 2023 16:55:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZugk-0005By-Sn; Sat, 26 Aug 2023 10:54:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZugj-0005Bq-3i for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2023 10:54:57 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qZugi-0002ui-Ro for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2023 10:54:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qZugo-0001Fy-1n for bug-gnu-emacs@gnu.org; Sat, 26 Aug 2023 10:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Aug 2023 14:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65491 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65491-submit@debbugs.gnu.org id=B65491.16930616894806 (code B ref 65491); Sat, 26 Aug 2023 14:55:02 +0000 Original-Received: (at 65491) by debbugs.gnu.org; 26 Aug 2023 14:54:49 +0000 Original-Received: from localhost ([127.0.0.1]:43294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZuga-0001FS-KI for submit@debbugs.gnu.org; Sat, 26 Aug 2023 10:54:48 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:38315) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZugW-0001FB-Mc for 65491@debbugs.gnu.org; Sat, 26 Aug 2023 10:54:47 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 954C8240104 for <65491@debbugs.gnu.org>; Sat, 26 Aug 2023 16:54:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1693061673; bh=bcERCLW0G9xl9+b84Ba/w7MaXonLew1ubKmRg7Vi1I8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=MZ/fRmpG53OQNvVY1OKl7AWoaVp1j9vL4Fg1hswRTylXOfAZ13RiKozBYEozV898Y nKG/lxHYJQmFPb+Uy0gdTjEAIaxJlj6tmdqnKgYo9ErSzG9YA+DAK3853W31B109SH UDki8vAyUNprl5ZFKF4oYNx3+vyC/48zIZK70Juhx4JEFuc63g/9yi9g8cA17845fy WYOrno+cAr42nMl7vmtubitPcayffICHZ3s1s1MxuNDcDqvgSOmmLY8XQiLZ5EtBPm bZTMa1nzYy4XyximKyiHHwsDMTRRfi96nbiniSCj3UcGaGZJyZIvNgDhhReLNAcz7n a6o4GENuFVIng== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RY0GC2VY4z6txf; Sat, 26 Aug 2023 16:54:27 +0200 (CEST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268510 Archived-At: Mattias Engdeg=C3=A5rd writes: > First of all, let's leave bignums out of this entirely. They are not rele= vant here. > > Second, please do not motivate any perceived performance problem from > benchmarks found on the internet, especially anything derived from the > Gabriel benchmarks. This includes the benchmarks in ELPA. > That said, vectorlike object allocation in general is definitely > relevant and can certainly be improved but I'm not persuaded by the > proposed patch. Please do not apply it right away. I have no problem with this and I have supplied more relevant benchmarks with Org and with composition (as suggested by Eli). Of course, the problem is not with bignums - it just revealed the inefficiency with array iteration I tried to address. If more can be done with vectorlike allocation, it will be even better. > However, the important part is not the patch but the problem it highlight= s, and here there is evidently plenty to do.=20 > > For example: > > - isn't vector_free_list twice as big as it needs to be? AFAIR, trying to reduce this array size was the first thing I tried. When I touched VECTOR_BLOCK_SIZE, I got segfaults and compilation failures. (Do note that I am missing understanding about the motivation behind this constant). > - to what extent are we duplicating the work done by modern libc allocato= rs (very generously including glibc here)? > - next_vector is a dangerously unstable concoction of C undefined behavio= ur Isn't vector_free_list following the pattern used across alloc.c? For example, Fcons uses a similar idea with holding pre-allocated memory as a chain of pointers. --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at