Currently observable resolution is implemented via full scan of a single linked list. In case of many properties it might cause performance degradation.
The solution is to switch the storage on the fly when it reaches some limit. An array sounds like a good solution due to constant time random access. Since .NET uses auto layout for classes, fields are aligned and packed well. It allows us to compute an observable index as offset / IntPtr.Size. In a worst case when fields are tightly packed it will fallback to scan over a few items inside a bucket like it happens for hash sets.
Currently observable resolution is implemented via full scan of a single linked list. In case of many properties it might cause performance degradation.
The solution is to switch the storage on the fly when it reaches some limit. An array sounds like a good solution due to constant time random access. Since .NET uses auto layout for classes, fields are aligned and packed well. It allows us to compute an observable index as
offset / IntPtr.Size. In a worst case when fields are tightly packed it will fallback to scan over a few items inside a bucket like it happens for hash sets.