Skip to content

First load very slow on older hardwareΒ #57

@maniac103

Description

@maniac103

JEmoji version

1.7.0

Steps to reproduce

When running (an app using) the library on an older device, the first EmojiManager static method invocation takes a very long time due to that class' static initializer. On a Sony Xperia X compact times up to 2 seconds were seen - see here for details.

What is expected?

Short initialization time (say < 100ms)

What is actually happening?

Very long initialization time (up to 2 seconds)

Any additional comments?

A lot of the time seems to be spent generating lookup maps for every possible use case; however, apps do typically use only a very specific subset of use cases. In our example, we only need 'replaceAliases`, so we don't need anything e.g. dealing with HTML entities. One solution therefore could be replacing the static map initialization by getter methods, initializing the static maps lazily once they're actually needed. Doing so would reduce both computing effort and memory usage in case only a subset of the library capabilities is actually needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions