I am confused by this flag. This flag allows us to allocate statically known arrays sizes of <= n to be allocated from the current nursery block. But looking at the code in allocateMightFail, as I interpret it, any size array up to LARGE_OBJECT_THRESHOLD is anyway allocated from the current nursery block. So why have this option? Why not fix this to LARGE_OBJECT_THRESHOLD? Maybe I am missing something.

-harendra

On Fri, 7 Apr 2023 at 15:45, Harendra Kumar <harendra.kumar@gmail.com> wrote:


On Fri, 7 Apr 2023 at 12:57, Simon Peyton Jones <simon.peytonjones@gmail.com> wrote:
> We are emitting a more efficient code when the size of the array is smaller. And the threshold is governed by a compiler flag:

It would be good if this was documented.  Perhaps in the Haddock for `newByteArray#`?  Or where?

The flag is documented in the GHC user guide but the behavior would be better discoverable if `newByteArray#` mentions it.

-harendra