At the last meeting we came up with a representation for objects that was based on a hash-table. It occurred to me that, if there are few properties, a linear search in an array will be faster. My intuition is that objects with few properties are accessed often. Can we verify this with our tracing framework?
With linear search there is also the possibility of moving elements in the array to accelerate the lookup time. For example, when a property is found it could be swapped with the first element of the array, so that if an access to the same property occurs next, then the property is found on the first try. There are other fairly simple LRU algorithms that could be used.
Finally, the linear search algorithm is simple enough to be inlined, which eliminates the call to the hash-table lookup function.
We should try to determine if this is true for some benchmark programs.
Note that we could have both representations. Initially a linear search would be done, and when there are greater than "Pmax" properties, then a hash-table would be used. We just have to arrange for the inlined "linear search" algorithm to immediately fail, and fallback to the hash-table lookup done in the out-of-line handler.
Marc