Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customization of public suffix DB loading behavior by Platform #8580

Open
Esteth opened this issue Nov 18, 2024 · 3 comments
Open

Allow customization of public suffix DB loading behavior by Platform #8580

Esteth opened this issue Nov 18, 2024 · 3 comments
Labels
enhancement Feature not a bug

Comments

@Esteth
Copy link

Esteth commented Nov 18, 2024

On some platforms, Java Resources are expensive to load and encode compared to a platform's native solution for bundling data. The public suffix file is loaded using Java Resources.

This is the case on Android, where Android Resources are faster to load and smaller to store than Java Resources as used in PublicSuffixDatabase.kt

Ideally, each Platform could choose to override the loading behavior for the public suffix database, falling back to the default behavior with java resources since it's supported on all java platforms.

@Esteth Esteth added the enhancement Feature not a bug label Nov 18, 2024
@yschimke
Copy link
Collaborator

We have an android module, so we could make it conditional on that. I'll take a look.

But we would need to prove it's noticeably faster to be worth the effort.

@Esteth
Copy link
Author

Esteth commented Nov 18, 2024

I'm virtually certain there are memory wins to be had because AFAIK using Java Resources on android require holding the EOCD zip table for the whole APK in memory in perpetuity once they've been accesed. Loading that table from disk and unpacking it can also take some time.

For small apps this is a small cost, but for large apps that table can be large (1MB+) because it contains strings for all the files in the APK among other things.

@JakeWharton
Copy link
Collaborator

It's only 40KiB. It could fit into a ByteArray of some class...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature not a bug
Projects
None yet
Development

No branches or pull requests

3 participants