Use a hash table to index existing vtables (#5314)
* Use a hash table to index existing vtables
This allows for quick deduplication even in situations where there
might be thousands of vtables due to 'combinatoric explosion'.
This fixes issue #5301.
* Refactor 0-offset trimming
* Improve deduplication benchmark
The routine now generates a set of realistic logical layouts and
uses a timer function that randomly picks a layout for each iteration.
The benchmark runs in batches of # of logical layouts = 1, 10, 100, 1000.
(Note that due to alignment, the actual number of vtables is usually slightly
higher.)