An IDS file is a list of specifications. Each one says which elements it applies to and what those elements must have: "every element has some attribute set", "every element's name starts with a storey code", "every wall has Pset_WallCommon.LoadBearing". The IDS model checker checks them one at a time, and a build server checks several IDS files against the same model.
Some public IDS files write rules that apply to every entity in the model, not only the walls and doors. On the HHS Office MEP export that is 665,224 entities, most of them geometry. The checker already skips most of the work for those entities, but it still ran each rule's tests on each of them.
So we counted. With the 68 IDS files we test on (3 starter files and 65 published on GitHub), checked one after another against that one model, the checker ran 11,378,962 facet tests. 7,867,322 of them, about seven in ten, repeated a test it had already run on the same element with the same facet.
Where the repeats come from
- The same "applies to" in many rules. The 539 specifications have only 153 distinct applicability sections. Ten of them, in two files, apply to every entity through an entity name pattern that takes every class, and each ran that test on all 665,224 entities.
- A rule's requirement that is another rule's applicability. One published fixture uses "has some attribute set" to choose the elements for two rules. A third rule requires the same facet twice. That one facet was tested 2.0 million times on 665,224 entities.
What the checker keeps now
A parsed model keeps two things for the length of a run:
- Each distinct applicability's result. The key is the facets' full content, so two rules that differ only in a value, a pattern or a data type do not share one. When the result takes most of the model it is kept as the few elements it leaves out (none, for "every entity").
- One byte per element for a facet's verdict (not tested yet, passes, absent, fails), for a facet run over more than a quarter of the model. At most eight facets are kept, the least recently used dropped first: 665 KB each on this model, 3.7 MB on our 219 MB federated test model.
The reasons written for a failing element still come from the full test. So a cached verdict that wrongly said "fails" would be corrected there. Only one that wrongly said "passes" could change a report, and the new test plants faults of that kind to make sure it notices.
Results
The same 68 files now run 3,650,434 facet tests on that model, and 138,794 of them repeat (mostly the second test that writes the reasons of the up to 1,000 failures a rule keeps). Two runs each on the four exports, Node 22, 4 vCPU; every report hashes the same as before.
| model | before | after |
|---|---|---|
| HHS Office MEP, 39.6 MB | 6.3-7.0 s | 5.0-5.3 s |
| HHS Office architect, 13.1 MB | 3.1-3.3 s | 2.3-2.4 s |
| HHS Office construction, 3.9 MB | 1.1-1.3 s | 1.0-1.1 s |
| Schultz Residence, 22.5 MB | 3.4 s | 2.5 s |
| federated test model, 219 MB, 2 GB heap | 60.4 s | 43.1 s |
| federated test model, 219 MB, 1 GB heap | 92-100 s | 55-57 s |
The cache that tipped a run over 1 GB
The first version kept list results as arrays of element references. On the federated model under a 1 GB heap, the run had less than 40 MB to spare before the change. This version ran out of memory although it held only 4 MB more. Moving the kept results into Int32Arrays (element ids, or the positions of the few elements a result leaves out) put the live heap back to main's 991 MB, but 2 of 6 runs still failed. What remained was garbage: rebuilding "every entity" grew a 3.7 million entry list one push at a time, and each outgrown copy had to be collected. Allocated at its final size, the peak heap matches main's and 6 of 6 runs finished.
A new test builds five IDS files that repeat facets on purpose. It checks them and the three starter files against one shared copy of the sample house, then each on its own. Every report has to equal the report from a fresh model with the caches off (check(..., { facetCache: false })). Seven planted faults each fail it: a key that ignores a value, a pattern or a data type; the left-out list ignored; and verdicts that pass what they should not.
The counts, the method and what is left (the ifcXML reader still builds every entity up front) are in eval/applies-cache-2026-11-18.md.