Skip to content

Commit

Permalink
LDEV-5158 set initial size for query.toString() stringbuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Nov 14, 2024
1 parent d6f04cf commit 66abc04
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/main/java/lucee/runtime/type/QueryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1594,8 +1594,15 @@ public QueryColumn getColumn(Collection.Key key, QueryColumn defaultValue) {
@Override
public String toString() {
Collection.Key[] keys = keys();
// each column is padded out 23 chars + 1 char, 3 header rows, query / recordcount... better initial size
int size = ((( 23 * (2 * keys.length)) + 1) * (getRecordcount() + 3)) + 35;
if (sql != null ) size = size + sql.getSQLString().length() + 55;
if (exeTime > 0) size = size + 25 + 55;

StringBuffer sb = new StringBuffer();
//lucee.aprint.o("");
//lucee.aprint.o(size);

StringBuffer sb = new StringBuffer(size);

sb.append("| Query: ").append(this.name).append("\tRecordCount: ").append(getRecordcount()).append('\n');

Expand Down

0 comments on commit 66abc04

Please sign in to comment.