Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize string construction #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/main/gov/nasa/jpf/jdart/JDart.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ public String format(LogRecord record) {
// dont know cases
continue;
}
String file_output = "";
String out = "";
StringBuilder file_output_builder = new StringBuilder();
StringBuilder out_builder = new StringBuilder();
for (Variable v : p.getValuation().getVariables()) {
out += v.getResultType().getName() + ":" + v.getName() + "=" + p.getValuation().getValue(v) + ", ";
out_builder.append(v.getResultType().getName() + ":" + v.getName() + "=" + p.getValuation().getValue(v) + ", ");
String vResultType = v.getResultType().getName();
String type = null;

Expand All @@ -299,14 +299,14 @@ public String format(LogRecord record) {
}

if (type != null) {
file_output += type + ":" + p.getValuation().getValue(v) + "\n";
file_output_builder.append(type + ":" + p.getValuation().getValue(v) + "\n");
}
}
logger.info(out);
logger.info(out_builder.toString());

if (printStream != null) {
try {
printStream.print(file_output);
printStream.print(file_output_builder.toString());
} catch (Exception ex) {
logger.severe(ex);
}
Expand Down