Speed up ObjectIndex#add, part one

Instead of obtaining the complete class/interface hierarchy for ever
item we add, we can do that once per class; the next time we add an
item of the same class, we'll have the list already.

This shaves off around 10-15% of ImageJ's DefaultCommandService's
initialization.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Speed up ObjectIndex#add, part two

Instead of looking up the list for every interface implemented by the
current item to add, we cache pre-calculated lists for every class
we encountered.

This shaves off another 5-10% of ImageJ's DefaultCommandService's
initialization.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a helper for performance benchmarking

We often encounter the situation where a list of similar operations needs
to be sped up, and we need to find the most promising candidate quickly.
For example, when the startup of a context is slow, there are typically
only very few services dominating the time, and they are the best targets
for optimization.

The Timing helper makes it easy to find out those candidates by
accumulating a list of items with durations and reporting a sorted list
when the report() method is called.

The helper lives in src/test/java/ to avoid tainting the official
scijava-common API with it; that way, we can easily adapt it to new needs
or even break backwards-compatibility without having to worry about
bumping the version. In Eclipse, you can still use it because Eclipse is a
bit challenged with class path scopes: it simply mooshes all dependencies
together, including 'test' and 'compile' scoped ones, anyway.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
TO-UNDO: timings

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>