bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#58669: 28.2; bindat: str and strz not operating on vectors


From: Eli Zaretskii
Subject: bug#58669: 28.2; bindat: str and strz not operating on vectors
Date: Fri, 21 Oct 2022 20:16:24 +0300

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]