Version 0.60.0

Cache Hinting

In trCAD, the generation of solid geometry can be a resource-intensive process. To optimize performance, trCAD employs a caching system that stores the mesh data of solids after they are first generated. This allows for the reuse of mesh data when the same solid geometry is needed again, reducing the need for costly reconstructions.

However, the caching system may not always preemptively store a mesh on its first generation, which can lead to redundant processing if the solid is required multiple times. The hint_cache command addresses this by providing a hint to the trCAD interpreter that a particular solid is likely to be reused and should be considered for caching with higher priority.

Usage

The hint_cache command is used to mark a solid for priority caching. It takes a single argument, which is the solid variable that you want to suggest for caching. The command does not alter the solid itself but informs the caching system of its potential for reuse.

Example

solid s = sphere(5, <[0, 0, 0]>)
hint_cache s

In the example above, the solid s, which represents a sphere, is marked for priority caching. This means that the mesh data for s will be stored in the cache after its initial generation, making it readily available for future use without the need for regeneration.

Best Practices

To make the most effective use of the hint_cache command, it should be applied to solids that:

  • Are computationally expensive to generate.
  • Are expected to be used multiple times throughout the script.

Note

The hint_cache command is a performance optimization tool. Its use is recommended for advanced users who have identified performance bottlenecks in their scripts due to repeated solid constructions.

🗙

Search results for