Improve interpreter performance slightly
This commit is contained in:
parent
cbbcb4fe3e
commit
84ccac0edb
|
@ -18,7 +18,6 @@ public class InteractiveLispInterpreter extends LispInterpreter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void applyFinishingTouches() {
|
protected void applyFinishingTouches() {
|
||||||
environment.getOutput().println();
|
|
||||||
environment.getOutput().println(environment.decoratePrompt(""));
|
environment.getOutput().println(environment.decoratePrompt(""));
|
||||||
environment.getOutput().flush();
|
environment.getOutput().flush();
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,7 +412,6 @@ public class LispTerminal {
|
||||||
for (int c = outputReader.read(); c != EOF; c = outputReader.read())
|
for (int c = outputReader.read(); c != EOF; c = outputReader.read())
|
||||||
processOutput((char) c);
|
processOutput((char) c);
|
||||||
|
|
||||||
terminal.setCursorVisible(true);
|
|
||||||
terminal.flush();
|
terminal.flush();
|
||||||
terminal.close();
|
terminal.close();
|
||||||
}
|
}
|
||||||
|
@ -429,9 +428,7 @@ public class LispTerminal {
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void writeSegment() {
|
private synchronized void writeSegment() {
|
||||||
terminal.setCursorVisible(false);
|
|
||||||
printSegmentCharacters();
|
printSegmentCharacters();
|
||||||
terminal.setCursorVisible(true);
|
|
||||||
outputSegment = "";
|
outputSegment = "";
|
||||||
redisplayInput();
|
redisplayInput();
|
||||||
terminal.flush();
|
terminal.flush();
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class LispInterpreterTest {
|
||||||
builder.setInput(createInputStreamFromString("'pickle"), "input");
|
builder.setInput(createInputStreamFromString("'pickle"), "input");
|
||||||
builder.build().interpret();
|
builder.build().interpret();
|
||||||
|
|
||||||
assertEquals(format("{0}\n{1}\n{0}\n\n", PROMPT, "PICKLE"), outputStream.toString());
|
assertEquals(format("{0}\n{1}\n{0}\n", PROMPT, "PICKLE"), outputStream.toString());
|
||||||
assertEquals("", errorOutputStream.toString());
|
assertEquals("", errorOutputStream.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue