0

I have few methods which are indicated as slow by profiler of jvisualvm

enter image description here

Unfortunately, I can't see what can be improved, since methods are

    public int getDimensionValue(int index) {
        if( !containsDimension(index) ) {
            throw new IndexOutOfBoundsException();
        }
        return delegate.getValue(index);
    }


    public boolean containsDimension(int index) {
        return delegate.contains(index);
    }

Suppose contains is really slow, but how can caller be slow too if it just call it?

Self time means time without time of callees or including it?

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385

1 Answers1

0

Be careful when interpreting VisualVM's output: if you are looking at the "hot spots" list, you only see total time spent inside a method, regardless of call count. Now look at the actual call counts: they are quite huge numbers. So in your case, the method's aren't slow, they are just being called a lot. This does indicate that total performance would benefit most from those methods getting faster, but it doesn't say at all that the methods are slow. They may well be as fast as they can get, which means you already have an optimal program.

William F. Jameson
  • 1,833
  • 9
  • 14