When running a SpringBoot helloworld program with CDS, we found that the start up is faster with a dynamic archive than with a static archive:
https://github.com/iklam/cds-example/blob/e70b80f4f74d2fa45171d7011e44b379dc48656a/Makefile
# make run0 = no CDS (-Xshare:off)
# make run1 = default CDS archive
# make runs = static CDS archive
# make rund = dynamic CDS archive
#
# Example timing (with my JDK 17 personal build/20210420)
#
# run0: 1.702895430 seconds time elapsed ( +- 0.48% )
# run1: 1.573997668 seconds time elapsed ( +- 0.26% )
# runs: 1.478010901 seconds time elapsed ( +- 0.52% )
# rund: 1.397676981 seconds time elapsed ( +- 0.62% )
=========================
The reason is that classes loaded by custom loaders are supported only by the dynamic archive:
[class,load] org.springframework.util.StopWatch$TaskInfo source: shared objects file (top)
[class,load] .... [loader data ... a 'org/springframework/boot/loader/LaunchedURLClassLoader']
Such classes are not stored in the static archive, so they are loaded from the JAR file at runtime:
[info][class,load] org.springframework.util.StopWatch$TaskInfo source: jar:file:/jdk2/cds-example/target/cds-example-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/spring-core-5.3.6.jar!/