android / android/ndk

[BUG] Exceptions in arm64-v8a are slower than in armeabi-v7a

Open
#1,062 11 comments 0 reactions 1 assignee Claimed by @rprichard View on GitHub
bug
Dominant language
No language data
Stars
2.3k
Forks
310
PR merge metrics
No merged PRs in 30d

Description

#### Description

Exceptions on arm64-v8a are much slower than on armeabi-v7a. Profiling shows that most of the work is done in dl_iterate_phdr callback. Severity of this effect is proportional to the number of objects (and, possibly, their size) loaded by dynamic linker. Attached archive contains a very synthetic example that creates a hundred libraries and measures time of exception handling in an executable that depends on all of them. I received following results when running this example on the phone:
```
sizeof(void*) = 4
Caught 10000 exceptions in 879 ms
sizeof(void*) = 8
Caught 10000 exceptions in 7201 ms
```

Please set NDK and HOST_TAG environment variables before running the test.

Exceptions in a native code run from an actual Java application for Android is about ten times slower in arm64 version of the library than in armv7.

[extest.tar.gz](https://github.com/android-ndk/ndk/files/3510120/extest.tar.gz)
#### Environment Details

* NDK Version: 20.0.5594570
* Build system: bash script
* Host OS: Mac
* ABI: arm64-v8a
* NDK API level:21
* Device API level:28

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.