Hey there.
Straight to the point. IC’s stable memory exists in form of pages of 64k size. Is it cheaper to work with aligned by page size data and does it even make sense to align data in our super-virtual environment?
What I mean by alignment is - imagine I have allocated (stable_grow()
) two pages of stable memory and I have some data to store.
Now I have a choice:
- I can ignore pages completely (and the API actually wants me to do this) and just store my data like this:
page 1 page 2
[somedata-another][data----------]
- Or I can teach my program to understand pages and to align data according to their size like this:
page 1 page 2
[somedata------][anotherdata-----]