google / google/conscrypt

Reading properties by `getResourceAsStream` is really slow on Android

Open
#831 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
1.4k
Forks
326
Avg merge
16h 22m
Merged PRs (30d)
17

Description

I found a performance impact about getResourceAsStream when profiling my app. The static initializer of Conscrypt is taking more than 60% of the time my app's Application onCreate takes in total. Almost all the time is spent on calling `getResourceAsStream` method. The following stream reading is quite fast.

I've noticed Jake Wharton wrote the library [ThreeTenABP](https://github.com/JakeWharton/ThreeTenABP) for the same problem happening in library [threetenbp](https://www.threeten.org/threetenbp/). I will quote part of ThreeTenABP README here:

```
..., the threetenbp uses a JAR resource for loading timezone information. This is an extremely inefficient mechanism on Android.
```

Please consider more efficient ways such as Android asset, thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.