Performance of small allocations via prim ops

Harendra Kumar harendra.kumar at gmail.com
Fri Apr 7 10:28:57 UTC 2023


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 at gmail.com>
wrote:

>
>
> On Fri, 7 Apr 2023 at 12:57, Simon Peyton Jones <
> simon.peytonjones at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20230407/e07e6183/attachment.html>


More information about the ghc-devs mailing list