Skip to content

Sharing 0-length ByteArray#s

Motivation

Currently each 0-length ByteArray# on the heap takes 16 bytes of heap space. Yet, every copy is identical and could be shared just like we share constructors like Nothing.

Proposal

Modify newByteArray# 0 and newPinnedByteArray# 0 so that repeated calls provide the same shared MutableByteArray#.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information