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
Disposed blocks can be released to the ObjectPool or a variation thereof, at Block.new we can try looking at free blocks and using ones if possible (by initializeing over them), orelse doing a Block.allocate and storing the result in the pool.
This of course requires at least refcounting. As a matter of trade-off we can perhaps use a very simple refcounting approach (the one that breaks at cyclic references etc.). This shouldn't be too hard, just a few is_a?s in Block#add and others, increments/decrements in Block#parent= and others. After all, we're backed by Crystal's GC anyway, ± few blocks shouldn't be a problem.
This whole thing may not be worth it though; I have no idea. This depends on how many throwaway blocks are there in core/tests/Novika apps, and this I don't know. I guess there is only one way to find out!
The text was updated successfully, but these errors were encountered:
Although probably this will require a mark&sweep (ish) stage, although rare (like 10s or 100s of thousands of ticks rare), to clear used but unreachable blocks — Crystal's GC won't be able to do that because there's one reference, the one in the "used" list, and so they will never get collected unless we do it ourselves.
Disposed blocks can be released to the
ObjectPool
or a variation thereof, atBlock.new
we can try looking at free blocks and using ones if possible (byinitialize
ing over them), orelse doing aBlock.allocate
and storing the result in the pool.This of course requires at least refcounting. As a matter of trade-off we can perhaps use a very simple refcounting approach (the one that breaks at cyclic references etc.). This shouldn't be too hard, just a few
is_a?
s inBlock#add
and others, increments/decrements inBlock#parent=
and others. After all, we're backed by Crystal's GC anyway, ± few blocks shouldn't be a problem.This whole thing may not be worth it though; I have no idea. This depends on how many throwaway blocks are there in core/tests/Novika apps, and this I don't know. I guess there is only one way to find out!
The text was updated successfully, but these errors were encountered: