Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimizations for
write_cfg_data
(#4569)
Makes progress in fixing the slowdown as proofs get large. I'll call the "sync time" the time in between receiving a step result and starting to wait for the next step result on the master thread. As proofs get more and more nodes, calling `to_dict()` on every node gets progressively harder and this was taking up a substantial portion of the sync time as proofs got to 500+ nodes. Instead of generating the entire KCFG dict with `KCFG.to_dict()` before passing this to `KCFGStore.write_cfg_data()`, which discards all of this work anyway for the final product and replaces it with just a list of the node IDs, it is significantly faster to just pass it the list of the node IDs and have it use the KCFG object, which already has a dictionary storing nodes by ID to find the vacuous and stuck nodes, and to get the newly created nodes. This way we can call `to_dict()` on each node only when it is first created. To give an idea of a benchmark, I used a `LoopsTest.test_sum_1000()` (linear and long-running) with `--max-depth 1` and `--max-iterations 1000`. Before this change it gets to 1000 iterations in 59:06, and after this change it does it in 40:31. Before the change the sync time as this proof approached 1000 nodes ranged between about 3.4 to 4.2 seconds. After the change ranged from about 1.39 to 1.54 seconds. The big remaining chunk of sync time when the proof gets large seems to be in `get_steps()`. --------- Co-authored-by: Petar Maksimović <[email protected]>
- Loading branch information