From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: A read-based grep-like for symbols (el-search?) (was Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master)) Date: Fri, 01 Oct 2021 17:41:45 +0100 Message-ID: <875yugofxy.fsf@gmail.com> References: <25d8d72022b571db5291@heytings.org> <87h7e2xsl5.fsf@gmail.com> <25d8d72022e1ea7ed022@heytings.org> <87fstl7lzw.fsf@web.de> <87a6jt7ilx.fsf@web.de> <87fstlzlaq.fsf@gmail.com> <20211001070242.GC16352@tuxteam.de> <87a6jsohbs.fsf@gmail.com> 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="22156"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: tomas@tuxteam.de, emacs-devel To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 01 18:43:49 2021 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 1mWLdU-0005cs-R8 for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Oct 2021 18:43:48 +0200 Original-Received: from localhost ([::1]:53116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWLdT-0003bi-P4 for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Oct 2021 12:43:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWLbl-0001cp-UJ for emacs-devel@gnu.org; Fri, 01 Oct 2021 12:42:05 -0400 Original-Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:39604) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWLbX-0004Dy-7m for emacs-devel@gnu.org; Fri, 01 Oct 2021 12:42:00 -0400 Original-Received: by mail-wm1-x331.google.com with SMTP id i6-20020a1c3b06000000b0030d05169e9bso9528065wma.4 for ; Fri, 01 Oct 2021 09:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=B3NHPsgGK4mnPQ7W6J+8nQPX/5EJf/YxfmXt5cU21ls=; b=c6mAZaaOK78OPbsfjIc+a3DqJWuFKet96CmJNfmRTUHfndUk07I+h+DhQcy2tGF9DL uPQxUhO8/iTRqB+3zR9SKRAYvtZrfNrfjmA5XZMiaK5/Q03aehEkvwQ8b+2M9IGChvKH Up6GF6w68dtXIQ3OIhiy5kVhV77x+M4lmFVsxbTDqq9jrQTmZ3wH8U37TEp8hn3G+ls2 M4p6uuSjD89yItT+yIRfbn8kjd6bn9VkG/MQ9qKIZoX7GNMuuCCGvvhFFOyoC1OD99EE kYzV63pQEaJRzD0ZE+f2b4+SAkn45GtuV0Br2x4miNf3Hl8BgyCi+10mBP5HjRFmkQ2c Mimg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=B3NHPsgGK4mnPQ7W6J+8nQPX/5EJf/YxfmXt5cU21ls=; b=qGOnH99YIMlgpG4sJ2+8JPLy+8Qa4/WZ5m3qrtJOQJZHpUAc1/0fjr2QFP9WglCk7v X/0e9CpEyVPrNfhlHr62HZLVCmdT6/SjeTb2RpnjCJGOP7Y0hVO0THZV3Qr+ScTO4fr2 B0pcsRt08AKcCyzsVWq8cX0q1uakb97ZTZyj6sIDwxfpU2OT8kysIX47EiOfTGAyOzst fZv0khZxppUFNC7LiK17LGZDKy9pKdaN4vvMmwlNQVOsRtwV2rXTKc1LAeyq7vsrbSa9 +fFV7WrDhi7pH2NJ9m+JHwo3WsR+hX1i7tBxBVBw7FHU4hXD8giVDKmscuGCSZbpogSj Pqug== X-Gm-Message-State: AOAM530g7XceBiiFrl0VJi1V+UmPExfe7aIm9PT58B4ee1nHraWUX9h3 tBqN9KbxT4H1WA2ZJDynVnRLBwdBzx8= X-Google-Smtp-Source: ABdhPJxNiqQ7aCZYi+zX1xgY76LzkFFAlXlZfiqnIcd6CRe4hmccne/QufFVnqdl8wYzwN5i5Gc9og== X-Received: by 2002:a1c:151:: with SMTP id 78mr2323025wmb.188.1633106504893; Fri, 01 Oct 2021 09:41:44 -0700 (PDT) Original-Received: from krug ([62.48.174.238]) by smtp.gmail.com with ESMTPSA id t12sm3162567wrw.12.2021.10.01.09.41.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 09:41:44 -0700 (PDT) In-Reply-To: <87a6jsohbs.fsf@gmail.com> (=?utf-8?Q?=22Jo=C3=A3o_T=C3=A1vor?= =?utf-8?Q?a=22's?= message of "Fri, 01 Oct 2021 17:11:51 +0100") Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=joaotavora@gmail.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, 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.23 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" Xref: news.gmane.io gmane.emacs.devel:275995 Archived-At: Jo=C3=A3o T=C3=A1vora writes: > Jo=C3=A3o T=C3=A1vora writes: > >>> (benchmark 1 '(dolist (dir load-path) >>> (when (file-exists-p dir) >>> (let ((files (directory-files dir t "\\.el\\'"))) >>> (dolist (file files) >>> (unless (file-directory-p file) >>> (with-temp-buffer >>> (insert-file file) >>> (read-from-string (buffer-string))))))))) >>> >>> Reports 2.5 seconds here. > >> Are these Emacs's files? > > Nevermind, just saw it's load-path. Which makes sense. > > So I have to ask: is this an 'Emacs -Q' load-path? Anyway, the good news is that: * avoiding read-from-string, and using read isntead * using a single buffer * using insert-file-contents (insert-file is for interactive use) * using the Emacs -Q load-path speeds your snippet down from 2 to 0.2 seconds. The bad news is that your snippet was only reading the first form in a file, so when you read the whole file it takes 2.8 seconds on my corei7 machine to read the whole Emacs sources. So performance wise, it's not bad but can probably be improved. I don't th= ink it's gonna be stupidly hard because: * this is one of those embarassingly parallel problems. We could just spawn spawn `invocation-name' to use SMP * designing a caching strategy seems fairly easy here. Jo=C3=A3o