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
When we decode a genome to a neural net we tend to allocate a few arrays. It would be good to try and use ArrayPool (probably, actually MemoryPool.Shared ?) where possible to minimise allocation and GC activity.
This work can be guided by the memory and GC tracking info from the performance profiler - we can use the efficacy sampler project to generate the workload for this.
Using arrays from a pool also means we avoid the memory clearing/zeroing overhead that occurs when getting a new array from the heap.
The text was updated successfully, but these errors were encountered:
As a possible next step, we could rent the array used for connection weights in neural nets. This is a new array for acyclic nets, but is taken directly from the genome for cyclic nets. Hence, a wrapper type that is IDisposable can be used, with two versions, one which returns the array on disposal (for acyclic nets), and another that doesn't (for cyclic nets).
Further to that, we could also use ArrayPool for genome arrays instead of the current approach of trying to re-use arrays in offspring genomes where possible. That re-use means an array is not owned by any one genome, and thus we don't know when an array is ready to be returned to an ArrayPool (unless we reference count, which is probably going too far in terms of complexity of the codebase).
When we decode a genome to a neural net we tend to allocate a few arrays. It would be good to try and use ArrayPool (probably, actually MemoryPool.Shared ?) where possible to minimise allocation and GC activity.
This work can be guided by the memory and GC tracking info from the performance profiler - we can use the efficacy sampler project to generate the workload for this.
Using arrays from a pool also means we avoid the memory clearing/zeroing overhead that occurs when getting a new array from the heap.
The text was updated successfully, but these errors were encountered: