From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: kobarity Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Fix python-info-current-defun performance for large defuns Date: Sat, 16 Sep 2023 23:51:56 +0900 Message-ID: References: <83h6oa5fbd.fsf@gnu.org> <83zg1nkjqm.fsf@gnu.org> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16031"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Tom Gillespie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 16 17:27:50 2023 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 1qhXD3-00040i-8Q for ged-emacs-devel@m.gmane-mx.org; Sat, 16 Sep 2023 17:27:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhXCF-0000CG-85; Sat, 16 Sep 2023 11:26:59 -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 1qhWex-00054O-Te for emacs-devel@gnu.org; Sat, 16 Sep 2023 10:52:36 -0400 Original-Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhWeu-0007g3-Aq; Sat, 16 Sep 2023 10:52:35 -0400 Original-Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c39f2b4f5aso24166255ad.0; Sat, 16 Sep 2023 07:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694875945; x=1695480745; darn=gnu.org; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=bCYCRaAD2S+C2uhvcTNS+GYpYcqTGWiHz51uEVeolAw=; b=MEYpO6f/gyP6GAkWd6o/pws2jYlNBgyqMQC6QPUSshgH0k+GQSk7M1F6qvL9UAdSKe IP7HIOt+MCLYxg/zuS18YkU6ny/gUh+sriliLQUuyBR3E9EIG8QCLWte7bDLkCenxt1G tgHVtNxGhhIdrsWQaEiIfg2zmRpMmpE6QececNe8euQ8sI7kMAn6HR0dcUJ/LnNcZdDC 9uT77GebPXpNUl6Q6+bchm3UImy3vB2a2pa5Mxp9k7EPURIpM8HjavanHmtXXGE1htqU ZcgGPG+IYV4qyP1XgBFet9qj1Xc9MYYilU15oFNp3UXQTECSQ0egIpyn2jOGdKqATIom 7F9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694875945; x=1695480745; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bCYCRaAD2S+C2uhvcTNS+GYpYcqTGWiHz51uEVeolAw=; b=WHXsr5LUWgiqflTEfpmlH78PJ4rAs8QpfMpYKZ4sxlSLMQi/+72I1cPKXftNcBUE3y g4BDnee2nT6tDLsd6jjRmYE8euZ3aAISLmbTcSzyZDLkNPyvqLSDyd2zI5ZARKnuyYTR v49QiFlnNZVYADmM7zDugho6lMI01unc3ibWhcUG8lcjk6NRWbNVo/mlpgdgZsjqWcGK ai2MLzzIqPdRZiRBKNNGusCoLTmZHkEhGJKJ2PGsspkwLEafe4BOCDiQmqFWCws86b5M bHKcegzgCdicD10sP9fRcMnOspDClaOM+l9T8hWr+vlIV0ocq9pm/jBRex98JIkTLWjD /1YA== X-Gm-Message-State: AOJu0YxUPeVwE5wg6AH03kNiLigfi1e3uRP15i17T3xLEOr5XRcDvDT8 fhyNQDZ/aJ2kjfqmw9GLHEM= X-Google-Smtp-Source: AGHT+IEfJFTnrTQvQjO7T5/EF8kQ3q4vFdeiElnvPyetsO584RIzDf50JxZK1TiwU4vtziC89i5GEw== X-Received: by 2002:a17:902:8691:b0:1c4:a16:f88f with SMTP id g17-20020a170902869100b001c40a16f88fmr4015903plo.36.1694875944642; Sat, 16 Sep 2023 07:52:24 -0700 (PDT) Original-Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id n12-20020a170902d2cc00b001a5fccab02dsm241327plc.177.2023.09.16.07.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 07:52:24 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=kobarity@gmail.com; helo=mail-pl1-x62f.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-Mailman-Approved-At: Sat, 16 Sep 2023 11:26:58 -0400 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:310631 Archived-At: Tom Gillespie wrote: > Here's an updated patch with the fix and additional test for the > case kobarity identified. I also shortened the long lines. Best! Thank you for the updated patch. However, there still seems to be a bit of a problem. def a(): def b(): return if 1: def c(): return z = 1 When the point is at the "z = 1" line, python-info-current-defun should return "a", but the new function returns nil. I also noticed another subtle difference in behavior with the example added as an ERT: def a(): def b(): return if 1: def c(): return if 2: if 3: def d(): return If the point is on the empty line above "if 2:", the new function returns "a", while the current function returns nil.