forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make impl of ClassPathResourceIndex#getResourceKey() faster
Previous implementation: Warmup Iteration 7: 63202.300 ops/ms Warmup Iteration 8: 64074.043 ops/ms Warmup Iteration 9: 63297.222 ops/ms Warmup Iteration 10: 63905.908 ops/ms New implementation: Warmup Iteration 6: 234089.005 ops/ms Warmup Iteration 7: 234372.742 ops/ms Warmup Iteration 8: 235722.737 ops/ms Warmup Iteration 9: 233265.148 ops/ms Also added a test to make sure we don't break it.
- Loading branch information
Showing
2 changed files
with
39 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
.../core/src/test/java/io/quarkus/bootstrap/classloading/ClassPathResourceIndexTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.quarkus.bootstrap.classloading; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class ClassPathResourceIndexTestCase { | ||
|
||
@Test | ||
public void testGetResourceKey() { | ||
assertEquals("io/quarkus/core/deployment", | ||
ClassPathResourceIndex.getResourceKey("io/quarkus/core/deployment/MyClass.class")); | ||
assertEquals("io/quarkus/core/deployment", | ||
ClassPathResourceIndex.getResourceKey("io/quarkus/core/deployment/package/MyClass.class")); | ||
assertEquals("org/apache/commons", | ||
ClassPathResourceIndex.getResourceKey("org/apache/commons/codec/MyClass.class")); | ||
assertEquals("test.properties", ClassPathResourceIndex.getResourceKey("test.properties")); | ||
assertEquals("META-INF/maven/", ClassPathResourceIndex.getResourceKey("META-INF/maven/commons-codec/file.properties")); | ||
assertEquals("io/quarkus", ClassPathResourceIndex.getResourceKey("io/quarkus/MyClass.class")); | ||
assertEquals("META-INF/services/my-service", ClassPathResourceIndex.getResourceKey("META-INF/services/my-service")); | ||
assertEquals("META-INF/versions/17/io/quarkus/core", | ||
ClassPathResourceIndex.getResourceKey("META-INF/versions/17/io/quarkus/core/deployment")); | ||
} | ||
} |