[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: |
Stefan Monnier |
Subject: |
bug#58669: 28.2; bindat: str and strz not operating on vectors |
Date: |
Fri, 21 Oct 2022 12:47:37 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>> 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.
Stefan