2025-07-24 –, Main Room 6
This talk presents the implementation of hash consing in SymbolicUtils.jl, a Julia library for symbolic computation. By ensuring unique representation of structurally equivalent expressions, hash consing reduces memory usage and computational overhead. We demonstrate significant performance improvements, including memory savings and faster compile and simulation times, while simplifying code through built-in common subexpression elimination.
Symbolic computation is a cornerstone of tasks like model analysis, transformation, and code generation, which are critical in scientific computing and modeling. However, symbolic manipulation systems often suffer from redundancy, where structurally equivalent expressions are represented as distinct objects in memory. This redundancy leads to increased memory consumption and computational overhead, particularly in large-scale models.
In this talk, we present the implementation of hash consing in SymbolicUtils.jl, a core symbolic computation library in Julia. Hash consing ensures that only one unique instance of a structurally equivalent expression exists in memory. This optimization not only reduces memory usage but also improves performance by minimizing redundant computations. Additionally, hash consing provides built-in common subexpression elimination (CSE), simplifying the codebase and further enhancing efficiency.
We will discuss the design and implementation of hash consing, focusing on its integration into SymbolicUtils.jl. The use of weak references, implemented via Julia's WeakValueDict, ensures that the hash table does not prevent garbage collection, maintaining efficient memory management. We will also present experimental results demonstrating significant reductions in memory usage and improvements in compile and simulation times.
Key topics include:
- The motivation for hash consing in symbolic computation and its benefits for memory and performance.
- The integration of weak references and WeakValueDict for memory management.
- Performance benchmarks comparing memory usage and computational speed with and without hash consing.
- The implicit benefits of hash consing, such as built-in CSE and its impact on code generation.
This work significantly improves the efficiency of SymbolicUtils.jl and its downstream applications, making it more suitable for complex symbolic manipulations in modeling and simulation. We will also discuss limitations, trade-offs, and future directions, including potential optimizations for specific types of symbolic expressions and parallel symbolic computation.
Join us to learn how hash consing can enhance the performance of symbolic computation in Julia and contribute to more efficient modeling and simulation workflows.
MIT CS PhD student