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

Reduce memory load from DynamicStyleSheets #5

Open
andrew-k-21-12 opened this issue Jul 11, 2024 · 0 comments
Open

Reduce memory load from DynamicStyleSheets #5

andrew-k-21-12 opened this issue Jul 11, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@andrew-k-21-12
Copy link
Owner

andrew-k-21-12 commented Jul 11, 2024

Check styled.StyleSheet from Kotlin Wrappers: possibly there are some updates worth to be integrated into io.github.andrewk2112.kjsbox.frontend.dynamicstylesheet.DynamicStyleSheet.

Check DynamicStyleSheet#prepareCachedRuleSet: for each particular style variant it creates and stores a separate DynamicCssHolder inside DynamicStyleSheet#dynamicHolders. This really abuses memory for no reason.

Check DynamicStyleSheet#createStyleName: it uses simple class names to generate the corresponding style names. Such approach is prone to name clashes if there are, for example, multiple DynamicStyleSheets having the same name but placed in different packages.

Try to rewrite it to keep injecting all style variants for each context immediately as it's done now but to avoid storing all corresponding DynamicCssHolders. If it's impossible to be done then try to extract shared parts of all style variants to reduce unnecessary duplication. Review and fix the issue with name clashes for generated styles.

@andrew-k-21-12 andrew-k-21-12 added the enhancement New feature or request label Jul 11, 2024
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

No branches or pull requests

1 participant