Open Bug 1065040 Opened 7 years ago Updated 7 years ago

Investigate using OrderedHashMap instead of HashMap for some tables

Categories

(Core :: JavaScript: GC, defect)

defect
Not set
normal

Tracking

()

People

(Reporter: terrence, Unassigned)

References

(Blocks 1 open bug)

Details

HashMap iteration is incredibly slow. During sweeping, the GC iterates all hash tables. It may make sense to make some of our global cache tables into OHM, since OHM iteration is about 3x faster than HM iteration, if the other properties are not too much worse.
A better idea, which Luke just suggested in IRC, is to use a cmov instead of a branch and visit the dummy elements as well, but with a safe value. While there is still a data dependency for the CPU to deal with, having a uniform structure might allow for better pipelining.

The interface would look something like:

template <class Op, class T, T DeadElement> forAllElements(Op op);

Where the underlying iterator would |return isLive() ? entry() : DeadElement;|.
You need to log in before you can comment on or make changes to this bug.