
TL;DR
Replacing a Rust tagged enum with a 64-bit word in the Plush language interpreter resulted in a 17% performance increase. This optimization is part of ongoing efforts to enhance the interpreter's speed for real-time 3D animation rendering.
✦ Why It Matters
Consider evaluating your use of enums in performance-critical code to identify potential optimizations.
Key Takeaways
How It Works
The new low-bit tagging scheme encodes different value types within a 64-bit word, using the lowest bits for tagging. This allows integers and pointers to be stored efficiently while enabling fast comparisons.
The scheme also incorporates a self-tagging method for floating-point values, which maintains precision and avoids heap allocation for most cases.
Related