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
{{ message }}
Repository navigation
Investigate switching to binary search for struct field lookup #4
Currently we use an (augmented) linear search when matching struct fields to struct keys. This is performant if the number of fields is small (for some value of small) or the fields are serialized in roughly the same order as they're defined. If mgspec is used with the same schema for both serializer and deserializer, this is as efficient as it can get (matching is a single memcmp call).
For large numbers of fields or fields in different serialization orders, linear search likely won't perform as well. We should investigate modifying the search algorithm to maybe fallback to binary search if the first attempt fails (so we're still performant in the common case, but not terrible in the pathological case).
After some benchmarking, what we have here already seems to be the most performant solution for common sized structs. Branch prediction and cache effects trump big-O notation. Closing.
Activity
jcrist commentedon Jul 26, 2022
After some benchmarking, what we have here already seems to be the most performant solution for common sized structs. Branch prediction and cache effects trump big-O notation. Closing.
Fix `Meta(pattern=..)` memory leak / corruption (msgspec#1256)