pyphi.cache.cache_utils.entry_weight#

pyphi.cache.cache_utils.entry_weight(value)[source]#

Estimated bytes one cached value occupies, including its key and slot.

An ndarray view keeps its whole underlying buffer alive, and the cache may be that buffer’s only owner, so a view is charged the buffer of the array it derives from. A base that is itself also cached is then charged twice, so the estimate is conservative. A sequence — the combinatorial index tables are lists of tuples — is charged per element, since its cost is the elements rather than any single buffer.

Parameters:

value (Any)

Return type:

int