Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArC - replace Collections.unmodifiableSet() with JDK immutable set #20353

Merged
merged 1 commit into from
Sep 23, 2021

Conversation

mkouba
Copy link
Contributor

@mkouba mkouba commented Sep 23, 2021

This is only the first part of optimizations.

@mkouba mkouba requested review from Ladicek and Sanne and removed request for Ladicek September 23, 2021 10:18
@quarkus-bot quarkus-bot bot added the area/arc Issue related to ARC (dependency injection) label Sep 23, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Sep 23, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building 419a854

Status Name Step Failures Logs Raw logs
Initial JDK 11 Build Build Failures Logs Raw logs

Failures

⚙️ Initial JDK 11 Build #

- Failing: independent-projects/arc/processor 
! Skipped: core/test-extension/deployment devtools/bom-descriptor-json devtools/cli and 404 more

📦 independent-projects/arc/processor

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1-jboss-2:compile (default-compile) on project arc-processor: Compilation failure /home/runner/work/quarkus/quarkus/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/MethodDescriptors.java:[106,95] cannot find symbol symbol: class Objects location: class io.quarkus.arc.processor.MethodDescriptors

Copy link
Member

@Sanne Sanne left a comment

Choose a reason for hiding this comment

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

Looks nice! I haven't looked much into the new types; do they take less space?

@Ladicek
Copy link
Contributor

Ladicek commented Sep 23, 2021

The Set.of() return type is a direct implementation of an immutable set, so it should be more efficient by definition, both from time and space perspective. Specifically, the old code used Collections.unmodifiableSet() over a HashSet. A HashSet holds a HashMap. The HashMap holds an array, where each element is a linked list or a binary tree (open hashing). On the other hand, Set.of(more than 2 elements) returns an instance that directly holds an array of values (closed hashing). The only thing that may be worse is that the array size in the Set.of() implementation is 2 * the number of elements -- but that would only be worse when the set contained a big number of values, which should almost never be the case here.

@mkouba
Copy link
Contributor Author

mkouba commented Sep 23, 2021

Thanks Ladislav for an exhaustive description ;-).

but that would only be worse when the set contained a big number of values, which should almost never be the case here

Those sets will have a maximum of dozens of elements, but mostly less than ten elements.

@mkouba mkouba added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Sep 23, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Sep 23, 2021

Failing Jobs - Building c802ed3

Status Name Step Failures Logs Raw logs
Gradle Tests - JDK 11 Windows Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ Gradle Tests - JDK 11 Windows #

- Failing: integration-tests/gradle 

📦 integration-tests/gradle

io.quarkus.gradle.devmode.BasicKotlinApplicationModuleDevModeTest.main line 18 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in io.quarkus.test.devmode.util.DevModeTestUtils that uses java.util.function.Supplier, java.util.function.Supplierjava.util.concurrent.atomic.AtomicReference, java.util.concurrent.atomic.AtomicReferencejava.lang.String, java.lang.Stringboolean was not fulfilled within 1 minutes.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:166)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)

@mkouba mkouba merged commit 4ae3d96 into quarkusio:main Sep 23, 2021
@quarkus-bot quarkus-bot bot added this to the 2.4 - main milestone Sep 23, 2021
@quarkus-bot quarkus-bot bot removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/arc Issue related to ARC (dependency injection)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants