3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-02 01:13:18 +00:00

Implement batch initialization fix for O(n²) datatype performance issue

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-07-01 21:56:53 +00:00
parent 115da30317
commit b518327650
3 changed files with 55 additions and 0 deletions

View file

@ -2471,6 +2471,10 @@ cmd_context::dt_eh::dt_eh(cmd_context & owner):
void cmd_context::dt_eh::operator()(sort * dt, pdecl* pd) {
TRACE(new_dt_eh, tout << "new datatype: "; m_owner.pm().display(tout, dt); tout << "\n";);
// Batch initialize all constructor functions to avoid O(n²) behavior for large datatypes
m_dt_util.batch_initialize_constructor_functions(dt);
for (func_decl * c : *m_dt_util.get_datatype_constructors(dt)) {
TRACE(new_dt_eh, tout << "new constructor: " << c->get_name() << "\n";);
m_owner.insert(c);