I posted this as a response to another thread, so I’ll add it here:
Since the issue for most projects is not memory usage, we decided to sacrifice some memory usage in order to gain speed.
Two things “solved” the issue:
First - Avoid variants in components when possible, and create separated components instead of sets. We used to have 4 types of buttons in one component set, and experienced all kinds of bugs and performance issues the bigger the file got. This action not only helped with performance but also “fixed” known bugs like persistent/incorrect state changes playing the prototype (icons suddenly changed to default color, labels breaking, hovers using default state colors, you name it).
REASON FOR THIS: Figma loads all component states and variants when any given component is in the rendered view of the prototype. Therefore, it’s faster to have more components with less variants, rather than less components with a huge amount of variants. Even if in the end, the designed component is not representantive of what the dev team will do (they will probably generate less components with more flexibility, depends obviously on the case/dev).
Second - Avoid overlays. This is the part that I couldn’t solve, but managed to avoid. The way to avoid it is incredibly annoying, but fixes the issue.
1- We grabbed every view of the app, and converted it to a component itself.
2- Then, for any given overlay we wanted to add in one of those views, we create a new view that has 3 things:
- An instance of the view that acts as background for the overlay.
- An instance of a component called “Overlay shadow layer”, which is the grey shadow behind the overlays.
- The overlay on top of all.
This way we still only have to change the base view component, and the changes apply to all the views that have the overlay. It’s a hassle, and you lose the scroll position iirc, but it literally saved the day for us.
REASON FOR THIS: Can’t confirm, but it feels like Figma loads ALL the overlays internally at the same time in memory, hence when one is loaded, and the prototype becomes responsive again, then all overlays behave normaly. But this usually takes minutes to happen, so it’s a huge problem during client presentations.
Right now, we are sitting at around 16% memory usage, around 2-3% more than before taking these actions.
Hope this helps.