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
In 1ba607e we already improved the BaseLayerIter. However, there is an easy improvement we could do to the iteration code to reduce the memory from O(|base_circuit|) to something less than that. Currently, this linear memory cost is due to storing the inputs needed for each gate in a flat vec and calculating this for each gate in constructor. A, hopefully, better way would be to store a mapping of HashMap<GateId, u32> where we only store the inputs needed for gates of which at least one predecessor has already been processed and remove them when they are zero.
The intuition is that a gate for which no predecessor has been processed can't be yielded and once we yield a gate we can not yield it again, thus we don't need to store how many inputs are needed for these gates. Albeit a little more computationally costly, this should significantly reduce the memory cost of iteration objects for large base circuits.
The text was updated successfully, but these errors were encountered:
Hi, sorry for the late reply. Yes, you can definitely give it a try. If you have questions, don't hesitate yo ask. The last weeks were stressful, but I have more time now :)
In 1ba607e we already improved the BaseLayerIter. However, there is an easy improvement we could do to the iteration code to reduce the memory from
O(|base_circuit|)
to something less than that. Currently, this linear memory cost is due to storing the inputs needed for each gate in a flat vec and calculating this for each gate in constructor. A, hopefully, better way would be to store a mapping ofHashMap<GateId, u32>
where we only store the inputs needed for gates of which at least one predecessor has already been processed and remove them when they are zero.The intuition is that a gate for which no predecessor has been processed can't be yielded and once we yield a gate we can not yield it again, thus we don't need to store how many inputs are needed for these gates. Albeit a little more computationally costly, this should significantly reduce the memory cost of iteration objects for large base circuits.
The text was updated successfully, but these errors were encountered: