Skip to content

perf: Use LinkedHashSet instead of array backed collection in ObjectsStore#98

Open
wchill wants to merge 1 commit intoREAndroid:mainfrom
wchill:perf/use-linkedhashset
Open

perf: Use LinkedHashSet instead of array backed collection in ObjectsStore#98
wchill wants to merge 1 commit intoREAndroid:mainfrom
wchill:perf/use-linkedhashset

Conversation

@wchill
Copy link

@wchill wchill commented Mar 12, 2026

Fixes #97

ObjectsStore does not provide an API for random access, so there is no point in using a list or array because we get no benefit from constant-time random access, as long as we can guarantee ordering (which LinkedHashSet does). This speeds up add, remove, and contains operations from O(n) to O(1), which prevents the degenerate case mentioned in #97.

The underlying data structure is not exposed (because all accesses are proxied through ObjectsStore), so we don't need to worry about the extra functions that ObjectsList/ArrayCollection provides.

Speedup: approximately 4 minutes spent for decode/modify/encode/zipalign/sign total -> 26 seconds on a Ryzen AI 9 HX 370.

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.

Poor performance during APK decoding when APK contains many duplicate spec names

1 participant