allow configuring variable name cache max size in KeyImpl

Description

Lucee has an internal cache of variable names, which was hardwired to 5000

https://github.com/lucee/Lucee/blob/6.2/core/src/main/java/lucee/runtime/type/KeyImpl.java#L49

Once reached, Lucee re-calculates the key hash every time, for each loaded class, unless it’s in the existing cache.

add a new env var / system property -Dlucee.cache.variableKeys=50000 to increase this cache size (LUCEE_CACHE_VARIABLEKEYS as an env var)

We may revisit the default 5000, also it would be good to make this cache size visible, maybe logging out when it first gets reached?

setting LUCEE_CACHE_VARIABLEKEYS=0 disables this cache all together

Environment

None

Attachments

1
  • 14 Dec 2024, 01:05 am

Activity

Show:

Pothys - MitrahSoft 22 January 2025 at 09:22

, I have tested this ticket with Lucee version 6.2.0.289-SNAPSHOT. After setting the LUCEE_CACHE_VARIABLEKEYS environment variable to 50000 and checking the default max value, it now works as expected in the latest Lucee version, and the execution time is faster.

Pothys - MitrahSoft 18 December 2024 at 12:31

, I have investigated this ticket with Lucee version 6.2.0.229-SNAPSHOT. When I tried to run a build with LUCEE_CACHE_VARIABLEKEYS set to 50000 (max 5000), the execution time was higher.

Zac Spitzer 14 December 2024 at 01:05
Edited

with 0 and bypassing the hashmap lookup, it’s even faster

image-20241214-010408.png
[java] [script] Total Execution time: (561 s) [java] [script] Test Execution time: (532 s) [java] [script] Average Test Overhead: (33 ms) [java] [script] Total Test Overhead: (44,937 ms)

without the above bypass, it’s much slower

[java] [script] Total Execution time: (622 s) [java] [script] Test Execution time: (595 s) [java] [script] Average Test Overhead: (33 ms) [java] [script] Total Test Overhead: (43,958 ms)

Important to remember, these testcases run a lot of code only once, different applications, especiallu running in production may perform quite differently

Zac Spitzer 14 December 2024 at 00:46

hmmm, 767 was faster running the build too

[java] [script] Total Execution time: (609 s) [java] [script] Test Execution time: (582 s) [java] [script] Average Test Overhead: (33 ms) [java] [script] Total Test Overhead: (45,197 ms)

vs default 5000

[java] [script] Total Execution time: (624 s) [java] [script] Test Execution time: (598 s) [java] [script] Average Test Overhead: (32 ms) [java] [script] Total Test Overhead: (42,659 ms)

Zac Spitzer 13 December 2024 at 22:47

trying max size based on

https://trycf.com/gist/1bf91148b1cd7661c079cbbad7d4ab37/lucee5?theme=monokai

<cfscript> a = [] for (i=10; i < 20; i++){ arrayAppend(a, ((2 ^ i)*.75)-1 ); } dump(a.toJson()); </cfscript>

https://github.com/lucee/lucee-testlab/commit/0a3dfe4f19e61aaf83f92673d3f1166be28a783e

[ 767, 1535, 3071, 6143, 12287 ]

https://github.com/lucee/lucee-testlab/actions/runs/12324002667

alas github actions aren’t very consistent performance wise, 767 was the fastest at 129s, vs 134s for 5000

Fixed

Details

Assignee

Reporter

Priority

Fix versions

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

Created 13 December 2024 at 21:15
Updated 20 March 2025 at 13:01
Resolved 22 January 2025 at 09:22

Flag notifications