Skip to content

Commit 7d369b6

Browse files
committed
Cleanup EMO painting
Profile guided cleanup to remove extraneous calls and work.
1 parent c385cbc commit 7d369b6

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/projections/Tools/Timeline/EntryMethodObject.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -811,12 +811,17 @@ public boolean isDisplayed() {
811811

812812

813813
public boolean paintMe(Graphics2D g2d, final int actualDisplayWidth, final int topCoord, MainPanel.MaxFilledX maxFilledX){
814-
boolean paintedEP = false;
815-
// If it is hidden, we may not display it
816-
if(!isDisplayed()){
817-
return paintedEP;
814+
// The internals of isDisplayed() are replicated here since this function is on
815+
// the hot path, doing this allows us to skip a call to isIdleEvent() later on
816+
// and means we don't have to rely on the JVM to inline this
817+
final int entry = getEntry();
818+
if (data.entryIsHiddenID(entry)) return false;
819+
820+
final boolean isIdle = entry == Analysis.IDLE_ENTRY_POINT;
821+
if (isIdle && (!data.showIdle() || MainWindow.IGNORE_IDLE)) {
822+
return false;
818823
}
819-
824+
820825
final long endTime = beginTime + elapsedTime;
821826
int leftCoord = data.timeToScreenPixel(beginTime, actualDisplayWidth);
822827
int rightCoord = data.timeToScreenPixel(endTime, actualDisplayWidth);
@@ -831,19 +836,19 @@ public boolean paintMe(Graphics2D g2d, final int actualDisplayWidth, final int t
831836
int rectWidth = Math.max(1, rightCoord - leftCoord + 1);
832837
int rectHeight = data.barheight();
833838

834-
int left = leftCoord+0;
839+
int left = leftCoord;
835840
int right = leftCoord+rectWidth-1;
836841

837842
// The distance from the top or bottom to the rectangle
838843
int verticalInset = 0;
839844

840-
final boolean isIdle = isIdleEvent();
841845
// Idle regions are thinner vertically
842846
if (isIdle && data.getViewType() != Data.ViewType.VIEW_SUPERCOMPACT) {
843847
rectHeight -= 7;
844848
verticalInset += 3;
845849
}
846850

851+
boolean paintedEP = false;
847852
// Only draw this EMO if it covers some pixel that hasn't been filled yet
848853
if (right > maxFilledX.ep) {
849854
maxFilledX.ep = right;

0 commit comments

Comments
 (0)