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
This is definitely relevant to #48 and is a spinoff of @bmeyers original cache idea in the rejected PR #42 , and a continuation of the accepted PR #43, that closed the relevant issues #34 and #35 about copies, and of course the ability to delay calculation #59.
The idea is simple, every time you make a calculation in __setattr__ or in calcCells():
check the cache for a similar cell, it's hash should be identical
if the cell doesn't exist yet, then calculate it and store the cell in a cache, like @bmeyers does in Better memory #42 except just store the entire PVcell, no need to serialize it (the cell) right now
The cache should be in pvconstants and should probably have a limit of 100 or 1000 cells. Any strategy can be used to determine which cells to keep in the cache, for example, a count could be kept of how many times each cell was called, and then the least popular cells are culled as needed.
This cache could be repeated for modules and strings as well.
This is definitely relevant to #48 and is a spinoff of @bmeyers original cache idea in the rejected PR #42 , and a continuation of the accepted PR #43, that closed the relevant issues #34 and #35 about copies, and of course the ability to delay calculation #59.
The idea is simple, every time you make a calculation in
__setattr__or incalcCells():PVcell, no need to serialize it (the cell) right nowThe cache should be in
pvconstantsand should probably have a limit of 100 or 1000 cells. Any strategy can be used to determine which cells to keep in the cache, for example, a count could be kept of how many times each cell was called, and then the least popular cells are culled as needed.This cache could be repeated for modules and strings as well.
sample code:
This works! Generate two different
PVcellsthat are identical, but have different memory locations, and the calculated hash is the same.then in
PVmodules