improve toString() performance for structs and arrays by setting initialCapacity for stringbuilder

Description

I noticed testbox does a toString on objects which adds overhead to tests

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

looking into the code which does toString for structs and arrays, I noticed it was using the default for string builder which is 16 characters

I did some tests and improved the run of the tests by defaults to (size * 10) by 8s with slightly better memory usage too

before

Total Execution time: (206 s) Test Execution time: (194 s) Average Test Overhead: (15 ms) Total Test Overhead: (19,654 ms) Active Threads: 354 CFTHREADS: 5,450 HEAP G1 Eden Space: 0%, 1,224 Mb, (+ 1,218Mb ) HEAP G1 Old Gen: 31%, 1,248 Mb, (+ 1,195Mb )

after

Total Execution time: (198 s) Test Execution time: (185 s) Average Test Overhead: (13 ms) Total Test Overhead: (18,008 ms) Active Threads: 351 CFTHREADS: 5,450 HEAP G1 Eden Space: 0%, 618 Mb, (+ 606Mb ) HEAP G1 Old Gen: 28%, 1,152 Mb, (+ 1,099Mb )

(memory depends on GC etc, so just an indicator)

Activity

Show:

Zac Spitzer 8 November 2024 at 15:57

6.2.0.159 - Total Execution time: (268 s)

6.2.0.160 - Total Execution time: (249 s)

Fixed

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

Fix versions

Priority

Created 8 November 2024 at 15:25
Updated 13 November 2024 at 13:23
Resolved 8 November 2024 at 15:58

Flag notifications