Avoid re-registration if member not found in UnsafeMemberAccessStrategy#783
Conversation
|
I think this solution is not yet perfect because if you have nonexistent member in a concrete type that doesn't change its shape (be ware of dictionary, dynamic etc) the result could be cached as shared undefined accessor. |
|
Do you mean there is a bug in your PR or before it? |
|
To my understanding, it's currently a feature. The path goes to |
|
Right, I think I am now caching it in the other branch I mentioned. |
|
BTW, totally off-topic. The Thoughts:
What kind of structure/strategy would be appropriate here? LRU with a size limit? Weak dictionary? |
I don't have definitive answer, like always.. Maybe for "cache miss" data it would make sense to cache a fixed set of data - for example last 10 misses that are bound to context (like Type), that could ensure that it's not unbounded. Weak dictionaries are a bit hard as they need to have something to attach to and in these cases it might not be obvious what's the GC root - I might be wrong as I really haven't thought about the problem that much / or have context. |
|
I will ask AI, it knows everything |
UnsafeMemberAccessStrategywill always call Register again if member was not found. It's enough to have invalid reference in Liquid template for this endless re-registration to kick in.