Skip to content

Commit

Permalink
8310170: Use sp's argument to improve performance of outputStream::in…
Browse files Browse the repository at this point in the history
…dent and remove SP_USE_TABS

Reviewed-by: shade, dholmes, stuefe
  • Loading branch information
jdksjolen committed Jul 7, 2023
1 parent 25cbe85 commit 92ca670
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/hotspot/share/utilities/ostream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,9 @@ void outputStream::put(char ch) {
write(buf, 1);
}

#define SP_USE_TABS false

void outputStream::sp(int count) {
if (count < 0) return;
if (SP_USE_TABS && count >= 8) {
int target = position() + count;
while (count >= 8) {
this->write("\t", 1);
count -= 8;
}
count = target - position();
}

while (count > 0) {
int nw = (count > 8) ? 8 : count;
this->write(" ", nw);
Expand Down Expand Up @@ -257,7 +248,7 @@ void outputStream::date_stamp(bool guard,
}

outputStream& outputStream::indent() {
while (_position < _indentation) sp();
sp(_indentation - _position);
return *this;
}

Expand Down

1 comment on commit 92ca670

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.