unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 58669@debbugs.gnu.org, nacho.barrientos@cern.ch
Subject: bug#58669: 28.2; bindat: str and strz not operating on vectors
Date: Fri, 21 Oct 2022 20:16:24 +0300	[thread overview]
Message-ID: <83sfjhumfr.fsf@gnu.org> (raw)
In-Reply-To: <jwvwn8t86sz.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Fri, 21 Oct 2022 12:47:37 -0400)

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: 58669@debbugs.gnu.org,  nacho.barrientos@cern.ch
> Date: Fri, 21 Oct 2022 12:47:37 -0400
> 
> >> Yes, I'm actually surprised I left this code in there as-is because
> >> I remember wondering how to make a unibyte string from a vector of bytes
> >> in an efficient way (and concluding that there's currently no good way
> >> to do that :-( ).
> >
> > Maybe I'm missing something, but what's wrong with
> >
> >   (apply 'string (append VECTOR nil))
> 
> `append` takes the vector, turns it into a list (thus allocating N cons
> cells), then `apply` turns the list back into an on-stack "vector", and
> all of that just to create a 4x or 8x smaller string.  It's silly.

It gets the job done, doesn't it?





  reply	other threads:[~2022-10-21 17:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 12:18 bug#58669: 28.2; bindat: str and strz not operating on vectors Nacho Barrientos
2022-10-20 20:57 ` Stefan Kangas
2022-10-21 15:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-21 16:02   ` Eli Zaretskii
2022-10-21 16:47     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-21 17:16       ` Eli Zaretskii [this message]
2022-10-21 18:34         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-23  8:18   ` Nacho Barrientos

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=83sfjhumfr.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=58669@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=nacho.barrientos@cern.ch \
    /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).