<div dir="ltr"><div>I was looking at the RTS code for allocating small objects via prim ops e.g. newByteArray# . The code looks like:</div><div><br></div><div>stg_newByteArrayzh ( W_ n )<br>{<br></div><div>    MAYBE_GC_N(stg_newByteArrayzh, n);<br><br>    payload_words = ROUNDUP_BYTES_TO_WDS(n);<br>    words = BYTES_TO_WDS(SIZEOF_StgArrBytes) + payload_words;<br>    ("ptr" p) = ccall allocateMightFail(MyCapability() "ptr", words);</div><div><br></div><div>We are making a foreign call here (ccall). I am wondering how much overhead a ccall adds? I guess it may have to save and restore registers. Would it be better to do the fast path case of allocating small objects from the nursery using cmm code like in stg_gc_noregs?</div><div><br></div><div>-harendra<br></div></div>