From: "Brennan Vincent" <brennan@umanwizard.com>
To: tomas@tuxteam.de, Eli Zaretskii <eliz@gnu.org>
Cc: acorallo@gnu.org, stefankangas@gmail.com, emacs-devel@gnu.org
Subject: Re: [PATCH] Add a mechanism for passing unibyte strings from lisp to modules.
Date: Wed, 26 Jun 2024 10:32:48 -0400 [thread overview]
Message-ID: <87ed8jkc4v.fsf@taipei.mail-host-address-is-not-set> (raw)
In-Reply-To: <ZnwYlVO0l4++PhJo@tuxteam.de>
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 <brennan@umanwizard.com>, acorallo@gnu.org,
>> > stefankangas@gmail.com, emacs-devel@gnu.org
>> > From: <tomas@tuxteam.de>
>> >
>> >
>> > 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
next prev parent reply other threads:[~2024-06-26 14:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 18:13 [PATCH] Add a mechanism for passing unibyte strings from lisp to modules Brennan Vincent
2024-06-21 18:13 ` Brennan Vincent
2024-06-21 19:08 ` Eli Zaretskii
2024-06-21 20:14 ` Brennan Vincent
2024-06-22 6:50 ` Eli Zaretskii
[not found] ` <87o77t6lyn.fsf@taipei.mail-host-address-is-not-set>
2024-06-22 16:12 ` Eli Zaretskii
2024-06-23 21:15 ` Andrea Corallo
2024-06-24 11:45 ` Eli Zaretskii
2024-06-25 17:36 ` Brennan Vincent
2024-06-26 12:26 ` Eli Zaretskii
2024-06-26 12:39 ` tomas
2024-06-26 13:23 ` Eli Zaretskii
2024-06-26 13:33 ` tomas
2024-06-26 14:32 ` Brennan Vincent [this message]
2024-06-26 15:53 ` Eli Zaretskii
2024-06-26 15:34 ` Eli Zaretskii
2024-06-27 3:36 ` Brennan Vincent
2024-06-27 6:05 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ed8jkc4v.fsf@taipei.mail-host-address-is-not-set \
--to=brennan@umanwizard.com \
--cc=acorallo@gnu.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=stefankangas@gmail.com \
--cc=tomas@tuxteam.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).