[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add 'bytevector-slice'.
From: |
Thompson, David |
Subject: |
Re: [PATCH] Add 'bytevector-slice'. |
Date: |
Wed, 11 Jan 2023 10:21:31 -0500 |
Hi Ludovic,
On Wed, Jan 11, 2023 at 10:00 AM Ludovic Courtès <ludo@gnu.org> wrote:
>
> +@node Bytevector Slices
> +@subsubsection Bytevector Slices
> +
> +@cindex subset, of a bytevector
> +@cindex slice, of a bytevector
> +@cindex slice, of a uniform vector
> +As an extension to the R6RS specification, the @code{(rnrs bytevectors
> +gnu)} module provides the @code{bytevector-slice} procedure, which
> +returns a bytevector aliasing part of an existing bytevector.
> +
> +@deffn {Scheme Procedure} bytevector-slice @var{bv} @var{offset} [@var{size}]
> +@deffnx {C Function} scm_bytevector_slice (@var{bv}, @var{offset},
> @var{size})
> +Return the slice of @var{bv} starting at @var{offset} and counting
> +@var{size} bytes. When @var{size} is omitted, the slice covers all
> +of @var{bv} starting from @var{offset}. The returned slice shares
> +storage with @var{bv}: changes to the slice are visible in @var{bv}
> +and vice-versa.
Just wanted to chime in to say that this is a really great new
feature! Bytevector slices will be very useful for performance
sensitive code that could benefit from using a pre-allocated memory
arena.
Really really great stuff! Thank you!
- Dave
The mysterious ‘SCM_F_BYTEVECTOR_CONTIGUOUS’, Ludovic Courtès, 2023/01/11
Re: [PATCH] Add 'bytevector-slice'., Maxime Devos, 2023/01/11