Skip to content

Neat 0.6.0: The Cache What Was Promised

Compare
Choose a tag to compare
@FeepingCreature FeepingCreature released this 30 Jan 16:22
· 80 commits to master since this release
  • Breaking change: class fields without mut can no longer be mutated.
    This change is necessary to allow optimization of refcounting on access to immutable class fields.
    In other words, for a class field assigned to an immutable variable:
    Class obj = new Class;
    Field field = obj.field;
    
    The field access now incurs zero refcounting overhead.
  • Macros are now cached between compiler runs, providing a significant speedup on warm cache.
    As usual, if you get strange compiler or linker errors, rm -rf .obj.

I have been looking to add macro caching for years. The entire functionality of macro import is designed around it. And yet, there were always complications. Well, I've finally come upon a straightforward way that reuses the taskpool system to track changes in files that contributed to a macro ("bill of materials") without requiring a full reparse. The cache files are stored in .obj/macrocache_* and are simple JSON. Performance benefit varies widely based on project complexity, but should be "noticeable" in any case, with the greatest benefit seen in the testsuite, where macro compilation previously consumed the majority of runtime.