Open
Description
We should optimize Thread.detect_recursion
, e.g., by moving some of it to Java, using EconomicMap instead of {}.compare_by_identity
which forces computing object_id
.
That should also do the optimization of not computing the identity hash until needed if few objects are tracked.
We should also avoid the block if possible as that creates more indirections.
From #1992 (comment)