Skip to content

Conversation

@cartland
Copy link
Contributor

@cartland cartland commented Aug 15, 2025

The lint tool reported "AutoboxingStateCreation" warnings in multiple files. Using the generic 'mutableStateOf' for primitive types (Int, Float, Long) can lead to performance overhead due to autoboxing.

This commit resolves these warnings by replacing 'mutableStateOf' with its specialized, more performant counterparts ('mutableIntStateOf', 'mutableFloatStateOf', 'mutableLongStateOf') where applicable. This change improves performance by avoiding unnecessary object allocations for primitive state values."

cartland and others added 2 commits August 15, 2025 14:49
The lint tool reported "AutoboxingStateCreation" warnings in multiple files.
Using the generic `mutableStateOf` for primitive types (Int, Float, Long)
can lead to performance overhead due to autoboxing.

This commit resolves these warnings by replacing `mutableStateOf`
with its specialized, more performant counterparts (`mutableIntStateOf`,
`mutableFloatStateOf`, `mutableLongStateOf`) where applicable.
This change improves performance by avoiding unnecessary object allocations
for primitive state values.
@cartland cartland added the enhancement New feature or request label Aug 29, 2025
@cartland cartland merged commit 959474f into main Aug 29, 2025
4 checks passed
@cartland cartland deleted the cartland/perf-autoboxing-state branch August 29, 2025 21:55
dturner added a commit that referenced this pull request Sep 23, 2025
* main: (74 commits)
  Add basic WindowInsetsRulers cases (#621)
  Adding shadows code snippets (#620)
  Update the wear preview code
  Update state based (#619)
  add WindowInsetsRulers snippet (#616)
  Migrate snippets from dac/training/wearables/tiles/screen-size (#617)
  Resolve warnings in the Wakelock code snippets (#615)
  Disabling some "unused" warnings (#610)
  Add android_wear_tile_version_fallback (#614)
  Add viewmodel screen for KMP (#613)
  Fix missing snippet (#612)
  Add KMP ViewModel snippets (#611)
  docs(modifiers): Add TODOs for inspectableProperties lint warnings (#589)
  Fix: Prevent memory leak from implicit SAM conversion (#588)
  Fix(gestures): Handle pointer events inside awaitPointerEventScope (#590)
  Lint: Use specialized state holders to avoid autoboxing (#591)
  Refactor: Rename Composable functions to follow naming conventions (#592)
  Refactor(text): Use KTX extension for isDigitsOnly check (#593)
  Refactor(SearchBar): Reorder modifier parameter to follow convention (#594)
  Add padding to avoid overwriting TimeText (#529)
  ...
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.

3 participants