Use deferred sorting with Dict again to avoid performance regression

This tries to move sorting a Dict into the first find call again, but tries
harder to make the double-checked locking work correctly so that at least
concurrent calls to find are correct (but concurrent calls to find and
add, set or remove are still not allowed).
2 files changed