You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2026/08/19 04:09:54 UTC
(groovy) 02/02: GROOVY-12281: quantify the cost of groovy.use.classvalue=false in the guide
This is an automated email from the ASF dual-hosted git repository.
paulk-asert pushed a commit to branch groovy12281
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 7ec24cc22186a176312bddb33d3699112aafd6b0
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Aug 19 14:07:40 2026 +1000
GROOVY-12281: quantify the cost of groovy.use.classvalue=false in the guide
The escape hatch's trade-off was described as not measurable for most
applications. Measured (57 classic-dispatch JMH benchmarks): +4.8%
geomean with hot platform-receiver idioms up to ~1.4x, while compile
time is within 1%. The guide now states those numbers so integrators
can decide with their own workload in mind.
Co-Authored-By: Claude Fable 5 <no...@anthropic.com>
---
src/spec/doc/guide-integrating.adoc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/spec/doc/guide-integrating.adoc b/src/spec/doc/guide-integrating.adoc
index a7f930091f..695e7f53d6 100644
--- a/src/spec/doc/guide-integrating.adoc
+++ b/src/spec/doc/guide-integrating.adoc
@@ -397,7 +397,11 @@ Two supported measures release the class loader; either one suffices:
* Start the JVM with `-Dgroovy.use.classvalue=false`. Groovy then stores the associations in a
weak-key map instead of `ClassValue`. The trade-off is a hash lookup where `ClassValue` has a
- per-class fast path; for most applications the difference is not measurable.
+ per-class fast path. Compilation speed is unaffected (within 1% in our measurements), and for
+ applications that are not dispatch-heavy the difference is unlikely to be noticed; heavily
+ dynamic code, however, can see a few percent overall, with hot dynamic idioms on JDK-class
+ receivers (string coercions, ranges, safe navigation, map property access) up to roughly
+ 1.4 times slower. Measure with your own workload if dispatch performance matters.
* Clean up explicitly when the application is discarded (for example from
`ServletContextListener#contextDestroyed`):
+