optimise ArrayToList(arr, "")

Description

there are two potential improvements we can make to improve this implementation

https://github.com/lucee/Lucee/blob/6.1/core/src/main/java/lucee/runtime/functions/list/ArrayToList.java#L39

  1. it's common to use an array to buffer output then do arrayToList(arr,"") currently there is no short path for this operation, there is a short path for a single character delimiter. A short path in this case would reduce the size of the string buffer by half (no need to append an empty delimiter)

  2. We know the size of the final string buffer, so we could use sb.ensureCapacity( len * 2 ) to pre-size the string buffer

Activity

Show:

Pothys - MitrahSoft 3 May 2024 at 13:35

I've checked this issue with Lucee version 6.1.0.130-SNAPSHOT. Now, the implementation of arrayToList() has been improved and it works fine.

Michael Offner 1 May 2024 at 09:00

can you please give this a try and if all okay, set it to resolved.

Michael Offner 1 May 2024 at 08:57

Zac Spitzer 27 February 2024 at 06:39

Just test cases (2000 elements, large content, extensionList().toJson())

With Short Path and ensureCapacity

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

Fix versions

Priority

Created 27 February 2024 at 06:16
Updated 19 May 2024 at 09:30
Resolved 3 May 2024 at 13:35