8310170: Use sp's argument to improve performance of outputStream::indent and remove SP_USE_TABS

Reviewed-by: shade, dholmes, stuefe
This commit is contained in:
Johan Sjölen 2023-07-07 09:24:30 +00:00
parent 25cbe85d6f
commit 92ca670bf3

View File

@ -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);
@ -257,7 +248,7 @@ void outputStream::date_stamp(bool guard,
}
outputStream& outputStream::indent() {
while (_position < _indentation) sp();
sp(_indentation - _position);
return *this;
}