optimize query.toString() by setting initial capacity for stringBuilder

Description

calculate an initial size for the string builder based on the query size (rows+columns+formatting+headers)

this really impacts testbox performance due to always preparing error messages using .toString() even before the test fails

https://ortussolutions.atlassian.net/browse/TESTBOX-406

Activity

Show:

Zac Spitzer 10 December 2024 at 19:06

reviewing this again, I’m not sure this actually improves anything, it may be detrimental for performance

Zac Spitzer 15 November 2024 at 13:20

as an experiment, i tried this with both concat and just classic +, both started to performed really badly with the 10,000 row test, taking 5s

Zac Spitzer 14 November 2024 at 15:16

https://github.com/lucee/Lucee/pull/2442

local before patch

[INFO]      [java]    [script]     test.tickets.LDEV5158 [java]    [script]          (1 tests passed in 136 ms) [java]    [script] Total Execution time: (317 s) [java]    [script] Test Execution time: (271 s) [java]    [script] Average Test Overhead: (27 ms) [java]    [script] Total Test Overhead: (36,755 ms)

local with setting stringbuilder size

[INFO]      [java]    [script]     test.tickets.LDEV5158 [java]    [script]          (1 tests passed in 129 ms) [java]    [script] Total Execution time: (303 s) [java]    [script] Test Execution time: (258 s) [java]    [script] Average Test Overhead: (25 ms) [java]    [script] Total Test Overhead: (33,231 ms)

on github

before patch

[INFO]      [java]    [script]  test.tickets.LDEV5158 [INFO]      [java]    [script]   (1 tests passed in 146 ms) [INFO]      [java]    [script] Total Execution time: (295 s) [INFO]      [java]    [script] Test Execution time: (282 s) [INFO]      [java]    [script] Average Test Overhead: (14 ms) [INFO]      [java]    [script] Total Test Overhead: (19,078 ms)

with setting stringbuilder size

[INFO]      [java]    [script] Total Execution time: (199 s) [INFO]      [java]    [script] Test Execution time: (187 s) [INFO]      [java]    [script] Average Test Overhead: (14 ms) [INFO]      [java]    [script] Total Test Overhead: (18,202 ms)
Unresolved

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Priority

Created 14 November 2024 at 13:59
Updated 6 March 2025 at 11:37

Flag notifications