Cached Closures
Caching closures is a basic optimization Holy and Squash to work with "generic" Datatypes.(1#what-is-a-datatype) It works generally by storing an "input" index based on parameters, and saving the result shape ID. This caching system is important to make sure memory usage stays low (by not creating new serialization/deserialization functions), and to prevent ser/de IDs from getting out of hand in size. As an example, here's the vect3 caching src:
- Generic Datatypes are functions which take in Datatype(s) and return a Datatype
- Store the input types which have generated a closure recently, as well as what id the input maps to
- Cache the input type with the created vector id
Although caching is already done automatically for most things, there is an API for caching a datatype instantly as a numeric ID.