Repository navigation
Reduce cnativeapi shared library footprint via hidden visibility, section GC, and -Os - #44
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #25
Depends on libnativeapi/nativeapi-core#98
Reduce the native-asset shared library's general overhead while retaining the complete C API. On the same core sources, Linux x64 library size falls by 57.6% and macOS arm64 by 50.6%.
free_c_str), Dart event-loop shim, protocol host bridge and Android JNI bridge. Track the map as a build-hook dependency.fdbe282, which includes current core main and the matching export annotations.tools/verify_native_exports.pyto resolve every exported C declaration and check for leaked C++ symbols.Measured with identical core
fdbe282and Dart 3.14.0; Linux uses Ubuntu Clang 18.1.3. The baseline uses workspace main's build hook; the optimized build uses this PR.gzip measures this library alone, rather than the complete application archive. Builds retain all modules; per-feature builds are not introduced.
Validation:
./codegen check: 77 C ABI and 386 binding files up to date.dart analyze bindings/dart/cnativeapi: passed.nativeapi_fluttertests: 11 passed.python3 tools/verify_native_exports.py: all 685 required entries resolve, including the string deallocator; zero internal C++ exports on both platforms.Reproduce from the workspace root:
Use
--library <path> --allow-internalwith the verifier to measure an unhidden baseline.