The upcoming G1 remembered set changes (JDK-8017163) extensively use the CHT it. One issue with the current implementation is that resetting the internal table is very slow (actually deleting and new'ing a new one).
This is because the CHT destructor calls Value::destroy_node() on every element which is slow. Even the iteration over all elements (that are trivially destructable and its memory managed externally) is slow enough if there are thousands of tables with hundreds of elements to destruct.
The proposed solution is to add a dedicated method that just resets the internal table (optionally setting it to a new size) without going through new/delete of the CHT.
This is because the CHT destructor calls Value::destroy_node() on every element which is slow. Even the iteration over all elements (that are trivially destructable and its memory managed externally) is slow enough if there are thousands of tables with hundreds of elements to destruct.
The proposed solution is to add a dedicated method that just resets the internal table (optionally setting it to a new size) without going through new/delete of the CHT.