You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The specification state is not optimized at all and we have a lot of unnecessary memory allocations. This is partly because many users have assumptions about the internals and we have avoided breaking user code (even though technically it's not a breaking change). But, it's time to change that. For the upcoming version 9, we'll be not so aggressive, and we won't refactor everything from the ground up. We'll try to keep the public API mostly the same, but it will be a breaking change for the folks who've been relying on the internals.
The specification state mostly consists of various expression collections. Currently, all these collections are initialized during instantiation. So, we have several list objects regardless if they're used by the spec or not. This is wasteful, a single empty list allocates 56 bytes of memory.
In version 9 we'll set all the initial states to null. We'll still be spending 8 bytes per reference (on x64), it's not ideal and we have further plans for version 10. But, taking this incremental step would reduce the size of specifications considerably. The aim is to keep the size ~100 bytes for empty specs (currently is over 392 bytes). Also, users shouldn't pay for features they don't use.
Breaking Changes:
The public behavior will remain unchanged. The exposed IEnumerable properties will return Empty collections.
However, users who depend on the internals and assume the underlying collection is List and is initialized, would need to update their code. For instance, some users have taken shortcuts and do this ((List<WhereExpressionInfo<T>>)spec.WhereExpressions).Add(...). This would be a breaking change for them.
The text was updated successfully, but these errors were encountered:
The specification state is not optimized at all and we have a lot of unnecessary memory allocations. This is partly because many users have assumptions about the internals and we have avoided breaking user code (even though technically it's not a breaking change). But, it's time to change that. For the upcoming version 9, we'll be not so aggressive, and we won't refactor everything from the ground up. We'll try to keep the public API mostly the same, but it will be a breaking change for the folks who've been relying on the internals.
The specification state mostly consists of various expression collections. Currently, all these collections are initialized during instantiation. So, we have several list objects regardless if they're used by the spec or not. This is wasteful, a single empty list allocates 56 bytes of memory.
In version 9 we'll set all the initial states to null. We'll still be spending 8 bytes per reference (on x64), it's not ideal and we have further plans for version 10. But, taking this incremental step would reduce the size of specifications considerably. The aim is to keep the size ~100 bytes for empty specs (currently is over 392 bytes). Also, users shouldn't pay for features they don't use.
Breaking Changes:
The public behavior will remain unchanged. The exposed
IEnumerable
properties will return Empty collections.However, users who depend on the internals and assume the underlying collection is
List
and is initialized, would need to update their code. For instance, some users have taken shortcuts and do this((List<WhereExpressionInfo<T>>)spec.WhereExpressions).Add(...)
. This would be a breaking change for them.The text was updated successfully, but these errors were encountered: