Based off of the inuse memory in stereoscope we spend of lot of memory on copying the filetree for squashing. An observation here is that all tree mutation operations always create or replace nodes, but never mutate existing nodes. This means that we can share references across the multiple trees created for the squashfs functionality for each layer.
Here is a snapshot of inuse memory today for image read for a sample image:
Here is a snapshot of inuse memory after using map.Clone to shallow clone existing trees:
Based off of the inuse memory in stereoscope we spend of lot of memory on copying the filetree for squashing. An observation here is that all tree mutation operations always create or replace nodes, but never mutate existing nodes. This means that we can share references across the multiple trees created for the squashfs functionality for each layer.
Here is a snapshot of inuse memory today for image read for a sample image:
Here is a snapshot of inuse memory after using
map.Clone
to shallow clone existing trees:Partially fixes #233 in terms of inuse memory