Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f52551d9 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Intern package names in AppOps historical data.

AppOps historical data contains many repeated packages names stored in
attribute values, increasing disk space and reading/writing time.

This change makes a trivial adjustment to write these package names
as "interned" values gives the serializer the option of writing the
package name once and then using a lightweight backreference for all
future instances.  Existing benchmarks show substantial CPU and disk
improvements when interning is enabled.

Bug: 171832118
Test: atest FrameworksServicesTests
Change-Id: I6d4a01e13caaf294aa6e015c528b909163dcae10
parent 9e87dd24
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1488,7 +1488,7 @@ final class HistoricalRegistry {
        private void writeHistoricalPackageOpsDLocked(@NonNull HistoricalPackageOps packageOps,
                @NonNull TypedXmlSerializer serializer) throws IOException {
            serializer.startTag(null, TAG_PACKAGE);
            serializer.attribute(null, ATTR_NAME, packageOps.getPackageName());
            serializer.attributeInterned(null, ATTR_NAME, packageOps.getPackageName());
            final int numAttributions = packageOps.getAttributedOpsCount();
            for (int i = 0; i < numAttributions; i++) {
                final AppOpsManager.AttributedHistoricalOps op = packageOps.getAttributedOpsAt(i);