From f1de9b39eff1db44c00acd3e41902b3ec6124776 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 28 Nov 2023 20:17:46 +0100 Subject: [PATCH] perf: Use a hash set for fast lookup --- .../app/revanced/patcher/extensions/AnnotationExtensions.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt b/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt index e5bf9d8..f122bff 100644 --- a/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt +++ b/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt @@ -10,7 +10,7 @@ internal object AnnotationExtensions { fun Class<*>.findAnnotationRecursively(targetAnnotation: Class): T? { fun Class<*>.findAnnotationRecursively( targetAnnotation: Class, - searchedAnnotations: MutableSet, + searchedAnnotations: HashSet, ): T? { val found = this.annotations.firstOrNull { it.annotationClass.java.name == targetAnnotation.name } @@ -30,6 +30,6 @@ internal object AnnotationExtensions { return null } - return this.findAnnotationRecursively(targetAnnotation, mutableSetOf()) + return this.findAnnotationRecursively(targetAnnotation, hashSetOf()) } }