From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#48734: 28.0.50; Performance regression in `string-width`? Date: Mon, 31 May 2021 21:51:13 +0300 Message-ID: <83lf7u20v2.fsf@gnu.org> References: <87a6odmfp6.fsf@teknik.io> <83o8cs4t9m.fsf@gnu.org> <87y2bwk1nj.fsf@teknik.io> <83eedo4k3j.fsf@gnu.org> <87v970jwik.fsf@teknik.io> <835yz04ean.fsf@gnu.org> <87r1hoza6z.fsf@gnus.org> <834kek4aai.fsf@gnu.org> <87h7ijlats.fsf@gnus.org> <87y2bvozaf.fsf@teknik.io> <837djf2d0j.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22293"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48734@debbugs.gnu.org To: contact@imrankhan.live, larsi@gnus.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 31 20:52:36 2021 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 1lnn1f-0005Ys-B5 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 May 2021 20:52:35 +0200 Original-Received: from localhost ([::1]:41254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnn1e-0006Q2-2O for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 May 2021 14:52:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnn18-0006NO-Cy for bug-gnu-emacs@gnu.org; Mon, 31 May 2021 14:52:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51480) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnn18-0001Ev-4F for bug-gnu-emacs@gnu.org; Mon, 31 May 2021 14:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lnn18-0002CV-2y for bug-gnu-emacs@gnu.org; Mon, 31 May 2021 14:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 May 2021 18:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48734 X-GNU-PR-Package: emacs Original-Received: via spool by 48734-submit@debbugs.gnu.org id=B48734.16224870928419 (code B ref 48734); Mon, 31 May 2021 18:52:02 +0000 Original-Received: (at 48734) by debbugs.gnu.org; 31 May 2021 18:51:32 +0000 Original-Received: from localhost ([127.0.0.1]:34793 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnn0d-0002Bj-MY for submit@debbugs.gnu.org; Mon, 31 May 2021 14:51:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnn0a-0002BS-DR for 48734@debbugs.gnu.org; Mon, 31 May 2021 14:51:30 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55238) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnn0U-0000oK-UF; Mon, 31 May 2021 14:51:22 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2181 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnn0U-00016Y-9R; Mon, 31 May 2021 14:51:22 -0400 In-Reply-To: <837djf2d0j.fsf@gnu.org> (message from Eli Zaretskii on Mon, 31 May 2021 17:28:44 +0300) 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" Xref: news.gmane.io gmane.emacs.bugs:207722 Archived-At: > Date: Mon, 31 May 2021 17:28:44 +0300 > From: Eli Zaretskii > Cc: larsi@gnus.org, 48734@debbugs.gnu.org > > > (benchmark-run 1 > > (let ((str)) > > (with-temp-buffer > > (insert-file-contents "~/2591-0.txt") > > (setq str (string-replace "\n" " " (buffer-string)))) > > (print (string-width str)))) ;;;; beware this now hangs > > > > I waited a minute for it to finish before killing Emacs. > > Why would someone want to measure the visible width of a 550KB string? > Is that a real-life use case? > > But I think I see the reason, and will try to improve this. Turns out I completely misunderstood how find_automatic_composition works (because its API is deceptively similar to that of find_composition, and the crucial differences aren't documented). So I will need to restructure the code in lisp_string_width to deal correctly with automatic compositions; stay tuned.