Hi,

Maxime Devos <maximede...@telenet.be> skribis:

> Ludovic Courtès schreef op ma 04-07-2022 om 12:09 [+0200]:
>> I don’t think the optimizer makes any such assumption, except for
>> literal bytevectors.
>
> It _does_ assume that bytevector lengths don't change:

[...]

> As can be seen in the above output, it first determines
> the length of the bytevector and then compares it again the index
> (for the index check) and then actually reads th byte
> so it assumes that the length doesn't change in-between -- it's not an
> atomic operation!

Oh right.

> Even if it didn't, being able to assume bytevector lengths don't change
> is important for optimising code like (begin (bytevector-ref bv 9000) 
> (bytevector-ref 8999) ...)),
> to optimise out many range checks, though I don't know if Guile currently
> does that.

Indeed.

Ludo’.

Reply via email to