Reinstates some functionality removed by commit 0ba9a6a but makes the expensive operation optional (and default to off) (cherry picked from commit 7dc09adaf4)
0ba9a6a
7dc09adaf4