From 106eb4f9fe39f6785c319116b8a9fb60c05eee84 Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Tue, 14 Feb 2023 17:33:16 -0300 Subject: [PATCH] Optimize bytecode recording test performance - Change creation of a large collection in `BytecodeRecorderTestCase.java` from using a loop to using `Collections.nCopies` --- .../deployment/recording/BytecodeRecorderTestCase.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/deployment/src/test/java/io/quarkus/deployment/recording/BytecodeRecorderTestCase.java b/core/deployment/src/test/java/io/quarkus/deployment/recording/BytecodeRecorderTestCase.java index 146ba6e44e51e..ec0b93a409360 100644 --- a/core/deployment/src/test/java/io/quarkus/deployment/recording/BytecodeRecorderTestCase.java +++ b/core/deployment/src/test/java/io/quarkus/deployment/recording/BytecodeRecorderTestCase.java @@ -215,11 +215,7 @@ public String get() { @Test public void testLargeCollection() throws Exception { - List beans = new ArrayList<>(); - for (int i = 0; i < 100000; ++i) { - beans.add(new TestJavaBean("A string", 99)); - } - + List beans = Collections.nCopies(100000, new TestJavaBean("A string", 99)); runTest(generator -> { TestRecorder recorder = generator.getRecordingProxy(TestRecorder.class); recorder.list(beans);