Skip to content

Poor performance when overrunning a large obfuscation dictionary #413

@quat1024

Description

@quat1024

In one project, we use an obfuscation dictionary with 10,000 entries. We found that most CPU time was spent in proguard.obfuscate.DictionaryNameFactory.nextName.

It turns out we had more than 10,000 symbols to obfuscate in the project and ran out the dictionary. DictionaryNameFactory falls back to generating fresh names and checking them against the dictionary so it doesn't generate a duplicate, but this duplicate-checking uses a linear scan (List#contains, line 255), so our large dictionary was causing this code path to be very slow.

// Return the next different name from the other name factory.
do
{
name = nameFactory.nextName();
}
while (names.contains(name));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions