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

Overall Codebase Enhancement #74

Merged
merged 19 commits into from
Jan 14, 2024
Merged

Overall Codebase Enhancement #74

merged 19 commits into from
Jan 14, 2024

Conversation

jisungbin
Copy link
Owner

@jisungbin jisungbin commented Jan 14, 2024

Resolves #63.

This PR includes a substantial number of changes.

Key Changes

  • Actively leverages the Compose compiler's API. Previously, only essential parts were copied and pasted to minimize dependencies on the Compose compiler. However, this approach could lead to delays in incorporating the latest logic and potential bugs.
  • Delegates state change tracking to Snapshot.registerApplyObserver. By relying on the core implementation in the Compose runtime, a more resilient implementation can be provided.
  • Changes the scope of composable functions to the !Composer.skipping branch implementation. The previous approach relied on the scope of the trace API, but as the trace API can be disabled by users, it was an unstable implementation.
  • Alters the recomposition determination scope to Composer.skipToGroupEnd and Composer.ScopeUpdateScope implementations. By using more accurate conditions, a more robust and detailed implementation can be provided.
  • Calculates the KeyInfo for the same composable only once initially and then reuses this value. Additionally, manages userProvideName and location information in KeyInfo. This effectively reduces redundant calculations.
  • Updates Kotlin to 1.9.21.

Remaining TODOs Before Release

  • Provide the composable invocation tree. This will be implemented by continuously propagating information about the function that executed itself as a parameter.
    • In this case, as the user receives AffectedComposable as an argument, it is essential to cache the AffectedComposable with the keyName to prevent repetitive instantiation.
  • Document writing.
  • Specify Compose runtime stability information in the runtime API.
  • Write more diverse tests. Currently, only very basic tests have been written.

Preview

image

@jisungbin jisungbin added the enhancement New feature or request label Jan 14, 2024
@jisungbin jisungbin self-assigned this Jan 14, 2024
@jisungbin jisungbin changed the title Rebuilding the entire codebase Overall Codebase Enhancement Jan 14, 2024
@jisungbin jisungbin enabled auto-merge (squash) January 14, 2024 09:39
@jisungbin jisungbin enabled auto-merge (squash) January 14, 2024 09:53
@jisungbin jisungbin merged commit 65021f4 into main Jan 14, 2024
2 checks passed
@jisungbin jisungbin deleted the fix-mainlogic branch January 14, 2024 10:00
@jisungbin
Copy link
Owner Author

jisungbin commented Jan 15, 2024

@jisungbin
Copy link
Owner Author

jisungbin commented Jan 15, 2024

"Provide the composable invocation tree"

How...? (See https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerParamTransformer.kt.)

I've come up with an idea to achieve this without changing the function signature.

Replace every IrCall that invokes the function with a try-finally block. In the try block, perform 'record function caller - function call,' and in the finally block, do 'remove function caller record.' This way, I expect to efficiently record the function call stack.

@jisungbin
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Propose a new way to determine composable invalidation tracking scope
1 participant