From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: Preferred approach to inclusion of data in ELPA package Date: Wed, 30 Aug 2023 19:27:55 +0000 Message-ID: <87msy8s538.fsf@posteo.net> References: <28956ffc-6cc0-1f39-a26b-1453b48d61b1@hugot.nl> <878ra91ie7.fsf@posteo.net> <87bkf3vxm3.fsf@posteo.net> <87lee5sawg.fsf@posteo.net> <87v8cyw89h.fsf@hugot.nl> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21974"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Hugo Thunnissen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 30 21:28:15 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 1qbQrO-0005UT-3P for ged-emacs-devel@m.gmane-mx.org; Wed, 30 Aug 2023 21:28:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbQrC-0001b0-4J; Wed, 30 Aug 2023 15:28:02 -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 1qbQrA-0001ae-8N for emacs-devel@gnu.org; Wed, 30 Aug 2023 15:28:00 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbQr7-0004WD-Cr for emacs-devel@gnu.org; Wed, 30 Aug 2023 15:27:59 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 014F6240104 for ; Wed, 30 Aug 2023 21:27:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1693423676; bh=S17h2sphuXrFrz8FOHpjJJKsTT8MvgaURlFq80UoP20=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=k4/YnBXzY3kCuoh6nLswI8lt2hrLQpsmwLgvYx5QpFKa0r9dF9LvpkmMG5GE3byTF DihiXoOE1eSYkYesTX0uSvz3qAZ+/AJ/i01eu3T/x8sJeBiwnJRy4wQcyX0XDQ4F+y yfnD0bCzAeKzzPFUUGIvH0lR9K7KIMaoNfpmoRRnlXBxdzw9lh1HL6bhPW0su4mzEx 9mzW+YGmnr+NbbcWTA/X2AA5A12deW1Q/HUa4QYdBzzW4ac2TxbDUCPla3VuzKK5JO DGb+9zW8qR6iGqiG17GXgu37CvwWja7Oz0Fofiv8YiqVHV2yqbd7HTKl2C4tJYVxtS Hbm03HIr8XCMA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RbZ7v47QFz9rxM; Wed, 30 Aug 2023 21:27:55 +0200 (CEST) In-Reply-To: <87v8cyw89h.fsf@hugot.nl> (Hugo Thunnissen's message of "Tue, 29 Aug 2023 10:41:14 +0200") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=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.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:309554 Archived-At: Hugo Thunnissen writes: > Philip Kaludercic writes: > >> Hugo Thunnissen writes: >> >>> On 8/19/23 17:51, Philip Kaludercic wrote: >>>> Hugo Thunnissen writes: >>>> >>>>> On 8/17/23 23:14, Philip Kaludercic wrote: >>>>>> Another idea is to have a Makefile generate the file, like the one you >>>>>> describe in option 2., that is generate whenever the package is built >>>>>> and bundled into a tarball for distribution. That way you don't have to >>>>>> store a binary blob in your repository, and you can avoid burdening the >>>>>> user with additional computations at either compile or runtime. >>>>>> >>>>>> Does the generation require any special functionality/tools/code to be >>>>>> provided on the device the index is generated on? >>>>> The php function/class stubs are generated with a php script, but I'm >>>>> checking the resulting stubs file into git. The index itself can be >>>>> built with just my package based on the stubs file. >>>> I saw that, and the commit did not look that nice, but I cannot say that >>>> I have looked into the issue in sufficient detail to say with certainty >>>> or not that there is no better solution. >>>> >>> There are alternatives or improvements to this approach, which I >>> mentioned in my response to sbaug >>> (https://lists.gnu.org/archive/html/emacs-devel/2023-08/msg00748.html) >>> . I don't think I'll be able to get around having to distribute-, or >>> having the user download/generate some kind of index though. >> >> If PHP were available in the ELPA build environment, do you think that >> would change anything? >> > > Theoretically, yes, as I would not have to check the stubs into version > control. Is this a realistic scenario though? To generate stubs, I > currently require a PHP installation with a whole slew of extensions > installed to be able to generate stubs for them. Currently, I only do > this for PHP 8.2, but I will probably end up having to do this for more > versions of PHP. That is a whole lot of packages that would have to be > present in ELPA's build environment. And the list of extensions is not > guaranteed to be static either. In that case I had underestimated the effort. While not perfect, it seems the best approach for now might well be to track the generated file in the Git repository :/ > My current idea is to create container images for each version of PHP > and generate stub files by executing the generation scripts in these > containers. To give you an idea of the list of required packages, this > is an example of the installation step in a Dockerfile I'm using: > > RUN apt-get update && apt-get -y install \ > php8.2-memcached \ > php-redis \ > php8.2-bcmath \ > php8.2-bz2 \ > php8.2-cli \ > php8.2-common \ > php8.2-curl \ > php8.2-gmp \ > php8.2-intl \ > php-json \ > php8.2-mbstring \ > php8.2-mysql \ > php8.2-odbc \ > php8.2-opcache \ > php8.2-pgsql \ > php8.2-readline \ > php8.2-tidy \ > php8.2-xml \ > php8.2-xsl \ > php8.2-zip \ > php8.2-gd \ > php-bcmath \ > php-apcu \ > php-cli \ > php-imagick \ > php-intl \ > php-xdebug \ > php-amqp > >>>>> Also: If the former is the case, is the reduction in load time that >>>>> this brings even significant enough to be worth the bother or should I >>>>> just hold off on this while I look for a more efficient solution? >>>> I'd say it would be worth it, if the resulting package would be smaller >>>> and would load quicker. After all, the performance on your laptop might >>>> not be that significant of a difference, while for someone else with an >>>> older or slower device, a 30%-speedup is pretty significant. >>> >>> You're right, on less performant systems it could make a more >>> significant difference. And good news, after a few improvements the >>> load time is now down to ~150ms on my laptop. I also chose to load the >>> data when the mode is first initialized, so simply loading my package >>> won't cause the index to be loaded with it. The dumping of the index >>> is done automatically when it is not present, so it would technically >>> be fine to just distribute the PHP stubs with the package instead of >>> the .eld index file. This would just make the user wait a little >>> longer the first time they use the mode. >> >> Would it be possible to load the information when it is required >> (e.g. necessary for completion)? > > This is a good idea. Classes within the project's scope are already > parsed/indexed on demand like that, I should apply this to stub classes > as well. > > Global/native functions are another story though. Since they're not > namespaced, it's hard to break them into smaller loadable sets. Aside > from that, function completion generally requires the list of functions > to be loaded indiscriminately. Luckily, the functions only make up a > little over 1/4th of the stubs (~2000 out of ~7300 lines).