You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A byte array [and by extension Text] can be pinned as a result of three possible causes:
It was allocated by newPinnedByteArray#. [Text is never constructed using this primitive]
It is large. Currently, GHC defines large object to be one that is at least as large as 80% of a 4KB block (i.e. at least 3277 bytes).
It has been copied into a compact region. The documentation for ghc-compact and compact describes this process.
Especially 2 seems likely and a case where we could save a significant amount of time by avoiding copying. Could we use isByteArrayPinned# to check if the byte array is already pinned and in that case avoid copying?
The text was updated successfully, but these errors were encountered:
Ah, I didn't think about slicing. I guess it is best to only reuse the original byte array if it is both pinned and not sliced. Although perhaps it would be acceptable to reuse the original byte array if the slice is still like 90% of the original size, but I don't think that is particularly common.
The byte array underlying
Text
might already be pinned:Especially 2 seems likely and a case where we could save a significant amount of time by avoiding copying. Could we use
isByteArrayPinned#
to check if the byte array is already pinned and in that case avoid copying?The text was updated successfully, but these errors were encountered: