Skip to content

[TS] Improve performance of EtsHierarchy#321

Merged
Lipen merged 1 commit intomainfrom
lipen/perf-hierarchy
Aug 6, 2025
Merged

[TS] Improve performance of EtsHierarchy#321
Lipen merged 1 commit intomainfrom
lipen/perf-hierarchy

Conversation

@Lipen
Copy link
Copy Markdown
Member

@Lipen Lipen commented Aug 6, 2025

This PR improves the performance of EtsHierarchy by using hash maps, but also by using setOf(x) instead of hashSetOf(x), since setOf(x) is overloaded in Kotlin to provide more performant singleton set.

`setOf(x)` has better performance than `hashSetOf(x)`
@Lipen Lipen requested a review from CaelmBleidd August 6, 2025 12:46
if (etsClassType.isResolved()) {
val signature = (etsClassType as EtsClassType).signature.copy(name = typeName)
return suitableClasses[signature]?.let { hashSetOf(it) } ?: emptySet()
return suitableClasses[signature]?.let { setOf(it) } ?: emptySet()

Check warning

Code scanning / detekt

Use `orEmpty()` call instead of `?:` with empty collection factory methods Warning

This '?: emptySet()' can be replaced with 'orEmpty()' call
@Lipen Lipen merged commit 5efe4be into main Aug 6, 2025
6 checks passed
@Lipen Lipen deleted the lipen/perf-hierarchy branch August 6, 2025 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants