In the ObjectGraphWalker's hot loop, we look up if the key is absent from the visited: IdentityHashMap before doing work, to then add it at the end… This PR avoids the double look up by adding the entry first, with a marker object as value, and in case the key was already present we skip it. Avoiding the double lookup in the case the reference hadn't been encountered yet (i.e. probably most cases)
In the
ObjectGraphWalker
's hot loop, we look up if the key is absent from thevisited: IdentityHashMap
before doing work, to then add it at the end… This PR avoids the double look up by adding the entry first, with a marker object as value, and in case thekey
was already present we skip it. Avoiding the double lookup in the case the reference hadn't been encountered yet (i.e. probably most cases)