After multiple scanning for type inference going top-down and bottom-up, we keep building the types using AllOf, OneOf etc. Recently (first week of Sept), we made sure we are not storing duplicate types, and there are no logical errors in this side.
Yet I believe we still have significant memory footprint. I will be doing a benchmark before we plan the solution for this ticket.
May be this is not an immediate issue, yet placing a ticket to track it down later.
There are various ways to handle this building of large data structures representing types.
Maintaining a table instead of attaching the inferred type to every identifier as an optimisation. Expressions may not repeat, but identifiers do!
Pre-unification strategies instead of accumulating types that could have gone through an obvious unification. Example: No need to keep this towards the end AllOf( Result { ok: Some(U64), error: Some(Unknown) }, Result { ok: Some(U64), error: Some(Str) }). We could come up with a progressive type elimination to keep the memory footprint low
And a lot more...
Or may be there is a known theoretical way of doing this, and need discussions with @jdegoes .
After multiple scanning for type inference going top-down and bottom-up, we keep building the types using AllOf, OneOf etc. Recently (first week of Sept), we made sure we are not storing duplicate types, and there are no logical errors in this side. Yet I believe we still have significant memory footprint. I will be doing a benchmark before we plan the solution for this ticket. May be this is not an immediate issue, yet placing a ticket to track it down later.
There are various ways to handle this building of large data structures representing types.
identifier
as an optimisation. Expressions may not repeat, but identifiers do!AllOf( Result { ok: Some(U64), error: Some(Unknown) }, Result { ok: Some(U64), error: Some(Str) })
. We could come up with a progressive type elimination to keep the memory footprint lowOr may be there is a known theoretical way of doing this, and need discussions with @jdegoes .