chore(refactor): optimize memory hygiene by extracting inline Regex instances to constants#263
Merged
ProdigyV21 merged 1 commit intoMay 26, 2026
Conversation
Owner
|
This one is not ready to merge yet because it conflicts with latest main. The conflict is in Please rebase onto latest main and keep the existing regex constants/names from main instead of adding duplicate renamed versions. The idea itself is fine and low risk: it is just moving repeated |
511b35f to
0d1f926
Compare
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.
Summary of Changes
app/src/main/kotlin/com/arflix/tv/data/repository/CollectionTemplateManifest.kt: Extracted inlineRegex("[^a-z0-9]+")instantiation inslugifyto a top-level private objectCollectionManifestRegexes.app/src/main/kotlin/com/arflix/tv/data/repository/HttpLocalScraperRuntime.kt: Replaced multiple inlineRegexcreations with references to existing or newly created companion object constants (EPISODE_DIV_REGEX,DATA_IFRAME_REGEX,PLAYER_IFRAME_REGEX,T_HASH_REGEX, etc.) to avoid recompilation.app/src/main/kotlin/com/arflix/tv/util/ProfileAvatarFiles.kt: Moved inlineRegex("[^A-Za-z0-9._-]")intoProfileAvatarRegexes.SANITIZATION_REGEX.app/src/main/kotlin/com/arflix/tv/util/SubtitleScoring.kt: Extracted inline regexes (PURE_NUMBERS_RE,SUBTITLE_BRACKET_RE,SEPARATOR_RE) to file-level private constants.app/src/main/kotlin/com/arflix/tv/util/AppLogger.kt: ExtractedRegex("[^A-Za-z0-9_.-]")intoAppLoggerRegexes.FILENAME_SANITIZATION_REGEX.app/src/main/kotlin/com/arflix/tv/ui/screens/player/PlayerScreen.kt: ExtractedRegexinstances intoPlayerScreenRegexestop-level private object to avoid triggering recomposition and gc pressure during render paths.Why this improves the codebase
This explicitly fulfills the checklist directive for Memory Hygiene. By pulling heavy, immutable
Regexinstances out of hot paths, utility loops, and Compose functions, we drastically mitigate GC churn and avoid unnecessary regex recompilation overhead.Verification