This is an idea for an improvement + optimization for the type graph system. It introduces some complexity, but has some key benefits:
This finally clears the way to #134.
Performance improvement - we only convert entities that are actually used.
Removes dependency on ASTypeInfoCache
There may also be an opportunity to reduce the use of pivots by developing an EntityFactory or similar. That could be injected into TypeGraphReader and used to construct the appropriate entity types in a more-efficient way.
Proposed design (WIP):
Create new internal class TypeGraphReader:
Contains all the entity conversion logic from TypeMapConverter.
Works on JsonElement directly.
Create new internal class JsonTypeMap (name TBD):
Requires a JsonElement and the TypeGraphReader.
Expose functions to read entities, types, context, and metdata.
Update TypeMap:
Add internal constructor that accepts and wraps a JsonTypeMap.
"get" methods Fall back on JsonTypeMap if available.
Update TypeMapConverter:
Construct a singleton TypeGraphReader.
Remove entity conversion and construct a JsonTypeMap instead.
This is an idea for an improvement + optimization for the type graph system. It introduces some complexity, but has some key benefits:
There may also be an opportunity to reduce the use of pivots by developing an
EntityFactory
or similar. That could be injected intoTypeGraphReader
and used to construct the appropriate entity types in a more-efficient way.Proposed design (WIP):
TypeGraphReader
:TypeMapConverter
.JsonElement
directly.JsonTypeMap
(name TBD):JsonElement
and theTypeGraphReader
.TypeMap
:JsonTypeMap
.JsonTypeMap
if available.TypeMapConverter
:TypeGraphReader
.JsonTypeMap
instead.