From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: MPS: dangling markers Date: Sat, 29 Jun 2024 16:56:10 +0200 Message-ID: References: <87v81u85hv.fsf@localhost> <87frsx81m2.fsf@localhost> <87cyo180y2.fsf@localhost> <874j9d7zqe.fsf@localhost> <87sewvg6lw.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36541"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Stefan Monnier , emacs-devel@gnu.org, Eli Zaretskii , eller.helmut@gmail.com To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 29 16:56:38 2024 Return-path: Envelope-to: ged-emacs-devel@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 1sNZVG-0009Iw-I6 for ged-emacs-devel@m.gmane-mx.org; Sat, 29 Jun 2024 16:56:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNZUw-0005uF-L1; Sat, 29 Jun 2024 10:56:18 -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 1sNZUu-0005tt-Hc for emacs-devel@gnu.org; Sat, 29 Jun 2024 10:56:16 -0400 Original-Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sNZUt-0003YW-0f; Sat, 29 Jun 2024 10:56:16 -0400 Original-Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-57cd26347d3so1977619a12.1; Sat, 29 Jun 2024 07:56:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719672972; x=1720277772; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=iftNHfl45md6+K6KHvCdajWOeeFnF8PWoAUnr7dcY1M=; b=Xbt2DCh3GYmFoizBau50/XPfX8+CIoWAGb+into8xY2v2sg61JkVNwggyZVUNFNfhI 7CIgXYMO+wMvqnzu+ADX/7dG10tEisPuo5GXuAqaKXohINN5G4et2ptzgMnBNRtgeW6m ILXlKSW+bb3IOky7JNxT3rtlKGNqBSycJnnOdksF/xzhuwUBFGPxovax1vPdjXjrGg/w Lcd2f1LM5W7zfCKhoGC+Q/qFZUv4Y9/xwnpYFfy/Aj/VhK5uZKoAY+gi9BzvyjycGt53 YAHiY7Web1Fy/KtAPY6z5qlrvozhkY3NRZwRDUHqLyVjk1sE0wEUFKyNJ+LFyLs79fTP 23VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719672972; x=1720277772; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=iftNHfl45md6+K6KHvCdajWOeeFnF8PWoAUnr7dcY1M=; b=FOlhYYWoI/Wy8z565DGG0SUvcgoiLUn9zQ5Lu6c6vwrjYLOfYTrqzEDHQhCkUrzkyo 7fJ2NYyzvjrvORsUa+XX1bmhgJ3tp6jpDtF4cohBJTGieLore7ygz4VLrzlLHqhnpdjW tlOO5Qt7jzdoMUa10NZfcwdLLFB6+NbO0ClUpC/kX+zVU4eVRK5PSFA5domyW1BV67Bl MramhQk213+VeH2C/0XxCGY7aW7yP2s0Bv5CRlxg2RaqSo1y/DR6VkPmcBtjT6iaeS32 apHzWA2j5uZeAx6CTgzbgyuaF89cw2cSomvoAVvam1DT6B4FIeya+vy9EIB3nnk4g89A Ae+g== X-Forwarded-Encrypted: i=1; AJvYcCVNdLDu/hzGYPNTFr+yYm+K7LYoDzSqG/kW5vFfbLzN30eh6URkKrmcv/nHxjDvn8qCsDCNd5Tzmr/tv6NaYDDrGvVAopr+TVvi08fbGoZ7UC8= X-Gm-Message-State: AOJu0Yyz9jE9cAzUeWLDkmA/eCkcAzrVTkHSe+FNB1F8owBdfbiQYD1V bPVGLBpB7oBCb2JcTmFdBnwDJF4f7O2cnQMSoUHk/tnPfg0Nf+Xe X-Google-Smtp-Source: AGHT+IHWQpTzJomw9ejwrutHw26llyPwI3OvBksbZKYx/FF6SbAaTFICjx16BrQYQVj2bQVZMXcn9g== X-Received: by 2002:a17:906:899:b0:a6f:7826:41ea with SMTP id a640c23a62f3a-a7514498b5emr60019566b.39.1719672972274; Sat, 29 Jun 2024 07:56:12 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e36598.dip0.t-ipconnect.de. [217.227.101.152]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab0901adsm168457066b.185.2024.06.29.07.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jun 2024 07:56:11 -0700 (PDT) In-Reply-To: <87sewvg6lw.fsf@localhost> (Ihor Radchenko's message of "Sat, 29 Jun 2024 14:34:51 +0000") Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:320856 Archived-At: Ihor Radchenko writes: > I did a small perf benchmark generating large agendas multiple times, > and got the following output: > > 36.34% emacs emacs [.] igc_remove_marker > 35.77% emacs emacs [.] igc_add_marker > 3.41% emacs emacs [.] buf_charpos_to_bytepos > 2.12% emacs emacs [.] re_search_2 > 1.60% emacs emacs [.] re_match_2_internal > 1.13% emacs emacs [.] exec_byte_code > 0.95% emacs emacs [.] buf_bytepos_to_charpos > > I guess O(N) is not all the fast, after all :) Thanks for testing it, and yeah O(n) isn't that great. Bad is that I have no idea how to improve that ATM :-/. Problem is that weak entries can be set to nil, concurrently, while we are traversing the vector. So, compacting the vector while detecting dead markers in not an option because that would confuse the iteration. Easy and clean but expensive would be to make a copy and iterate over the copy. Especially expensive when we have many markers. Easy and probably also expensive (unknown) is to stop GCing while iterating. Hm, hm, hm. > (assoc-string "PVEC_MARKER" (igc-info)) gives ~200-600k markers with my setup. M-x igc-stats RET since yesterday, I believe :-) How many live and dead?