My version could eliminate some unnecessary computations but why my code is much slower?

```
int len = height.length;
int max = 0; int st = 0; int end = len-1;
int minLength = 0; int interval = 0;
while(st<end){
interval = end-st;
if(height[st]>height[end]){
minLength = height[end];
end--;
while(height[end]<=minLength) {
end--;
if(end<0) break;
}
}else{
minLength = height[st];
st++;
while(height[st]<=minLength) {
st++;
if(st>len-1) break;
}
}
max = Math.max(max, minLength*interval);
}
return max;
```