Skip to content

Conversation

radcortez
Copy link
Member

@radcortez radcortez commented Jun 23, 2025

This will reduce runtime operations in the native image by caching nested mapped implementation handles in a static block.

This comment has been minimized.

Comment on lines +122 to +127
Class<?> klass = Thread.currentThread().getContextClassLoader().loadClass(mappingClass);
return ConfigClass.configClass(klass, prefix);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm correct that no changes were made here? You just split the call in two lines.

How exactly do we leverage the cache?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was to make the call more visible, since this is only required to support non-public classes.

The cache is in SR Config:
https://github.com/smallrye/smallrye-config/blob/60923e71855c9f129132aab305a7dd168f219ed6/implementation/src/main/java/io/smallrye/config/ConfigMappingLoader.java#L25-L30

With a MethodHandle for the constructor:
https://github.com/smallrye/smallrye-config/blob/60923e71855c9f129132aab305a7dd168f219ed6/implementation/src/main/java/io/smallrye/config/ConfigMappingLoader.java#L172-L202

Which is used to construct the main mapping and each nested element:
https://github.com/smallrye/smallrye-config/blob/60923e71855c9f129132aab305a7dd168f219ed6/implementation/src/main/java/io/smallrye/config/ConfigMappingLoader.java#L87-L108

I had an idea some time ago that I could generate the constructors' bytecode for nested elements, which would improve this a bit more, but I don't have that yet.

@gsmet
Copy link
Member

gsmet commented Jul 1, 2025

Unfortunately, this now conflicts with main.

@radcortez radcortez force-pushed the cache-nested-mapping-implementations branch from 03265e4 to bf79e24 Compare July 1, 2025 19:23
@radcortez
Copy link
Member Author

Was just imports.

Copy link

quarkus-bot bot commented Jul 1, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit bf79e24.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.


Flaky tests - Develocity

⚙️ JVM Integration Tests - JDK 17 Windows

📦 integration-tests/logging-panache

io.quarkus.logging.LoggingWithPanacheDevModeTest.testRepositoryIsReloaded - History

  • io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.devservices.deployment.DevServicesProcessor\#config threw an exception: java.lang.IllegalThreadStateException: process has not exited at java.base/java.lang.ProcessImpl.exitValue(ProcessImpl.java:566) at io.quarkus.deployment.util.ContainerRuntimeUtil.getVersionOutputFor(ContainerRuntimeUtil.java:239) at io.quarkus.deployment.util.ContainerRuntimeUtil.getContainerRuntimeEnvironment(ContainerRuntimeUtil.java:116) - java.lang.RuntimeException
java.lang.RuntimeException: 
io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.devservices.deployment.DevServicesProcessor#config threw an exception: java.lang.IllegalThreadStateException: process has not exited
	at java.base/java.lang.ProcessImpl.exitValue(ProcessImpl.java:566)
	at io.quarkus.deployment.util.ContainerRuntimeUtil.getVersionOutputFor(ContainerRuntimeUtil.java:239)
	at io.quarkus.deployment.util.ContainerRuntimeUtil.getContainerRuntimeEnvironment(ContainerRuntimeUtil.java:116)
	at io.quarkus.deployment.util.ContainerRuntimeUtil.detectContainerRuntime(ContainerRuntimeUtil.java:66)
	at io.quarkus.deployment.util.ContainerRuntimeUtil.detectContainerRuntime(ContainerRuntimeUtil.java:55)

⚙️ JVM Integration Tests - JDK 21

📦 integration-tests/opentelemetry-grpc-only

io.quarkus.it.opentelemetry.grpc.HelloGrpcClientTest.testHello - History

  • java.lang.RuntimeException: Failed to start quarkus - java.lang.RuntimeException
java.lang.RuntimeException: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:668)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:763)
	at java.base/java.util.Optional.orElseGet(Optional.java:364)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
  • java.lang.RuntimeException: Failed to start quarkus - java.lang.RuntimeException
java.lang.RuntimeException: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:668)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:763)
	at java.base/java.util.Optional.orElseGet(Optional.java:364)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)

@gsmet gsmet merged commit 5974fb8 into quarkusio:main Jul 2, 2025
57 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.25 - main milestone Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants