From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}) Date: Sat, 20 Apr 2019 22:11:10 +0300 Message-ID: <83tvesa3w1.fsf@gnu.org> References: <8736md90v0.fsf@gmail.com> <83lg05b1jk.fsf@gnu.org> <87lg047h9n.fsf@gmail.com> <83y344a97a.fsf@gnu.org> <87bm107d7q.fsf@gmail.com> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="145299"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Alex Gramiak Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 20 21:21:53 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hHvYe-000bgW-E1 for ged-emacs-devel@m.gmane.org; Sat, 20 Apr 2019 21:21:52 +0200 Original-Received: from localhost ([127.0.0.1]:44586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHvYd-0007KH-CT for ged-emacs-devel@m.gmane.org; Sat, 20 Apr 2019 15:21:51 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHvYR-0007DK-L6 for emacs-devel@gnu.org; Sat, 20 Apr 2019 15:21:40 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36703) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHvOn-0005Bi-OB; Sat, 20 Apr 2019 15:11:41 -0400 Original-Received: from [176.228.60.248] (port=1597 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hHvOl-0002z6-3D; Sat, 20 Apr 2019 15:11:41 -0400 In-reply-to: <87bm107d7q.fsf@gmail.com> (message from Alex Gramiak on Sat, 20 Apr 2019 12:18:01 -0600) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235711 Archived-At: > From: Alex Gramiak > Cc: emacs-devel@gnu.org > Date: Sat, 20 Apr 2019 12:18:01 -0600 > > Ideally. Though in the case of vector-partition the size of the 2 > partition vectors is not known in advance, so a Lisp implementation > would have to create two extra Lisp vectors as opposed to using > SAFE_ALLOCA. That is, unless Elisp grows a growable/resizeable vector > type (which is something I was thinking about -- would that be denied?). What would be the advantage of that vs lists? > >> > As for speed, did you have any application where the speed of the Lisp > Well, it's a stupid itch, but sometimes I see the (memq elt of constants>) and think that using a vector would be faster/better, > mainly since memq has to check for cycles. You mean 'member', right? I don't think 'memq' checks for cycles. > More generally, there's currently no way to check existence in a > vector nearly as fast as one can check existence in a list, which is > unusual in programming languages. Vectors are used quite rarely in Emacs Lisp, IME. I think we should all keep in mind that Emacs Lisp is not a general-purpose language, it is a language for implementing and extending Emacs. > I don't believe that the vector-memq/member procedures would pose a > maintenance burden like some of the others (vector-apply in particular) > would. Every additional primitive means a burden. More importantly, we should IMO be consistent in how we design and implement families of functions, which is why I still think we should extend seq.el (possibly some of that with internal C primitives, if needed), instead of starting a new family.