From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Brennan Vincent" Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add a mechanism for passing unibyte strings from lisp to modules. Date: Wed, 26 Jun 2024 10:32:48 -0400 Message-ID: <87ed8jkc4v.fsf@taipei.mail-host-address-is-not-set> References: <225D336D-933E-4CA3-B245-89992D7E6C41@umanwizard.com> <86frt5jwtc.fsf@gnu.org> <87o77t6lyn.fsf@taipei.mail-host-address-is-not-set> <867cehgdn1.fsf@gnu.org> <861q4md0o1.fsf@gnu.org> <87jzickjq8.fsf@taipei.mail-host-address-is-not-set> <86wmmb99f7.fsf@gnu.org> <86ikxv96sd.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37381"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acorallo@gnu.org, stefankangas@gmail.com, emacs-devel@gnu.org To: tomas@tuxteam.de, Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 26 16:33:49 2024 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 1sMTiV-0009R1-11 for ged-emacs-devel@m.gmane-mx.org; Wed, 26 Jun 2024 16:33:47 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMThs-0007Ne-Rp; Wed, 26 Jun 2024 10:33:08 -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 1sMThq-0007NF-VN for emacs-devel@gnu.org; Wed, 26 Jun 2024 10:33:08 -0400 Original-Received: from smtp.umanwizard.com ([54.203.248.109]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMThn-0001o3-2b for emacs-devel@gnu.org; Wed, 26 Jun 2024 10:33:05 -0400 Original-Received: from localhost ([172.254.204.170]) by smtp.umanwizard.com ; 26 Jun 2024 14:32:50 +0000 X-Fes-Received-For: emacs-devel@gnu.org X-Fes-Received-From: In-Reply-To: X-Fes-Encrypted: true X-Fes-Ehlo-Domain: localhost Received-SPF: pass client-ip=54.203.248.109; envelope-from=brennan@umanwizard.com; helo=smtp.umanwizard.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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:320699 Archived-At: tomas@tuxteam.de writes: > On Wed, Jun 26, 2024 at 04:23:46PM +0300, Eli Zaretskii wrote: >> > Date: Wed, 26 Jun 2024 14:39:30 +0200 >> > Cc: Brennan Vincent , acorallo@gnu.org, >> > stefankangas@gmail.com, emacs-devel@gnu.org >> > From: >> > >> > >> > On Wed, Jun 26, 2024 at 03:26:52PM +0300, Eli Zaretskii wrote: >> > >> > [...] >> > >> > > > I think it would be great if emacs grew a specialized vector-of-bytes type. >> > > >> > > How will it be different from the Lisp vectors we already have? >> > >> > The box around every byte. >> >> What box? Please tell more, as I don't think I follow. > > Maybe I'm all wrong, but AFAIU, a vector can contain arbitrary Lisp > values. That makes 64bits/8bits plus boxing/unboxing (which is, I > assume, quick, but nonzero). > Yes, this was my reasoning as well. (setq foo (make-vector 1000000000 #x00)) causes emacs to consume (at least) 8G of RAM, whereas the similar C code: #define SZ 1000000000 char *foo = malloc(SZ); memset(foo, 0, SZ); only consumes 1G. > Having a specialized "array of bytes" (as there is one for bools) > might be beneficial for big arrays, and perhaps avoid big data moving > operations over the C/LISP fence. > > I do understand your reservations, but I do understand the OP's > wish as well :-) > > If at all, a "byte array" would be, of course, cleaner than a > unibyte string, with all its implicit magic. > > Cheers > -- > t