From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#65491: [PATCH] Improve performance allocating vectors Date: Sat, 16 Sep 2023 16:58:01 +0200 Message-ID: <6B2EDD07-AAEB-40E8-B369-F634296BD3D9@gmail.com> References: Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40641"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65491@debbugs.gnu.org, Eli Zaretskii To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 16 16:59:10 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 1qhWlJ-000AP1-Em for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Sep 2023 16:59:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhWl6-0005zF-Ns; Sat, 16 Sep 2023 10:58:56 -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 1qhWl4-0005yj-So for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 10:58:54 -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 1qhWl4-0000x1-Jd for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 10:58:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qhWlB-0000Ng-L7 for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 10:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Sep 2023 14:59:01 +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.16948763001414 (code B ref 65491); Sat, 16 Sep 2023 14:59:01 +0000 Original-Received: (at 65491) by debbugs.gnu.org; 16 Sep 2023 14:58:20 +0000 Original-Received: from localhost ([127.0.0.1]:48257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhWkW-0000Mj-Aj for submit@debbugs.gnu.org; Sat, 16 Sep 2023 10:58:20 -0400 Original-Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:58770) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhWkS-0000MU-4o for 65491@debbugs.gnu.org; Sat, 16 Sep 2023 10:58:19 -0400 Original-Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-503056c8195so647714e87.1 for <65491@debbugs.gnu.org>; Sat, 16 Sep 2023 07:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694876283; x=1695481083; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=KEorY5+NHQYg5+umqCFM0wAFmxUxY64eeNlLQjJSh/0=; b=M2EfZaewYBxSmMiFEiokkJ4/DVh7Tb7Fuj0HBS58rRkN7o83VgTzy5+Y8ion3liWTP 0uMYY0rQdWlx69dioUJiEHp4t+d+wZEO80JriCIPRMBbcgrz5uTo71LAl5YeUHLd1ihC fz67TqhbvGXGb3b2J3Jew5lw4lEjZM9ssSVmpM3melsfTGHEaeE+w7DdtpNZi17mQZvW 4M8g8wpmv2TSlQQ1JQS0AZ4Dnlqg5S8AgiwTm+1HFrY30jn4AryE8/9EgOL9VAxDRWx1 tUml/EfTu76ZY/Ea85+eoZlCS/n3d3OD13fraqyeibvp5cVoXfrHbi9bPRnRHE5lf+kc GJyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694876283; x=1695481083; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=KEorY5+NHQYg5+umqCFM0wAFmxUxY64eeNlLQjJSh/0=; b=qTCe5sQKnsuwh198FZwOLgAcKRrr0MJAPkdHb+jWIN+1yVRxjRU3oEFl8GSP3arwJO w/Km/nQzF3eb43egpRiS8yuMo2O7WjoHewM5on31NNVN5HZCtBiLgzYkpUSGZn3RRooX UP1Tx0syYmo8CVRcfyYcouw4iTdzelkKYQxVH2PHxKdgm0KN7P+6ks1j2WRnDm5OP494 v0leanYMNxFbY0dlSlH4wKywKeC4RmRQW77CUpuCF1g1aNRHXqrkDEpKVte1A2JIf5mO 4QhilOVn1PlY8VyCW+KIdwScJyNJ8dTaWkaQjyTXuMLfM6nFrIFKVx+tNGjYnDlz9ZTS +AJA== X-Gm-Message-State: AOJu0YzlK+XZr6v7nnmH0UoN+QgN5y1MK7zFWsM6Fi1hmImjh0FniFjM R330vD1n7oZqxU40xb3I8Km2b6aUUFg= X-Google-Smtp-Source: AGHT+IFtQ0ulQOuCg2yF4ftVRoGGV2fRKhQRdQz0nSRAl36I3Vs8Pdyv/F+FijHyQqF3Ssnr/EtVrQ== X-Received: by 2002:a19:500b:0:b0:501:ba56:65f8 with SMTP id e11-20020a19500b000000b00501ba5665f8mr3676588lfb.45.1694876282535; Sat, 16 Sep 2023 07:58:02 -0700 (PDT) Original-Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id l10-20020ac24a8a000000b004fdd9d43e05sm1065025lfp.171.2023.09.16.07.58.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Sep 2023 07:58:02 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3654.120.0.1.15) 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:270624 Archived-At: Results of some further experiments: - Reducing the `vector_free_lists` array to its actually used first half = does improve performance a bit, even with subsequent scanning speed-ups. - Enlarging `struct vector_block` from 4 KiB does not necessarily speed = things up but more measurement is needed. - Using a bitmap for faster `vector_free_lists` scanning is definitely = beneficial. - The previously mentioned hack where scanning begins in the most = recently added bucket is surprisingly effective, often even more so than = a bitmap, but I'm wary of it being brittle. Need more measurements. - Our special-casing of the bool-vector representation is annoying. It = would be good if we didn't have to pay the price on 64-bit platforms. I also pushed two small changes that were essential to working with the = code so we might just as well have them in now: b1881d7dab (fix a static = assertion) and 056c99a34c (better Lisp_Object untagging). I'd like to try size-homogeneous blocks as well, but this requires some = GC updates. Just a matter of taking the time, of course.