Skip to content

Refactoring: FrozenDictionary#7507

Open
JoonghyunCho wants to merge 1 commit intoSamsung:mainfrom
JoonghyunCho:refactor-frozendictionary
Open

Refactoring: FrozenDictionary#7507
JoonghyunCho wants to merge 1 commit intoSamsung:mainfrom
JoonghyunCho:refactor-frozendictionary

Conversation

@JoonghyunCho
Copy link
Member

@JoonghyunCho JoonghyunCho commented Mar 5, 2026

Apply FrozenDictionary for read-only lookup table optimization (.NET 8)

Description

Replaces immutable static readonly Dictionary<K,V> lookup tables with FrozenDictionary<K,V> (.NET 8) to optimize read-heavy lookup performance on Tizen Platform.

FrozenDictionary analyzes keys at construction time and generates an optimized hash strategy (e.g., perfect hash for strings, direct table for small enums), resulting in significantly faster TryGetValue/ContainsKey operations compared to standard Dictionary.

Benchmark Results (Tizen device)

Key Type Dictionary FrozenDictionary Improvement
String baseline ~30% faster ✅ Applied
Enum baseline ~25% faster ✅ Applied
Type baseline ~20% slower ❌ Not applied

Type keys showed regression because Type objects are runtime singletons with already-optimal reference-equality lookups. FrozenDictionary's hash optimization adds overhead in this case.

Changes

Source (6 FrozenDictionary conversions across 5 files, 3 projects)

Tizen.System.Information

  • RuntimeInfo.cs — s_keyDataTypeMapping (RuntimeInfoKey → Type)
  • Information.cs — StringEnumMapping (string → RuntimeInfoKey), EnumStringMapping (RuntimeInfoKey → string)

Tizen.System

  • PerformanceController.cs — PerformanceControlFunctions (PerformanceControlType → delegate)

Tizen.NUI

  • CustomViewRegistry.cs — daliPropertyTypeLookup (string → PropertyType)
  • PropertyHelper.cs — visualPropertyTable, visualPropertyUpperCaseTable, viewPropertySynonymTable (all string-keyed)

Benchmark App (NEW)

  • test/Tizen.Benchmark.Gallery/ — NUI app for on-device performance benchmarking
    • Button-based UI with per-benchmark and "Run All" execution
    • Results displayed in UI and console output
    • Extensible for future benchmark categories

Constraints

  • ✅ No API signature changes (all modified fields are internal or private)
  • ✅ No API behavior changes (FrozenDictionary implements IReadOnlyDictionary)
  • ✅ Collections modified after construction (Add/Remove at runtime) were excluded
  • Type-keyed dictionaries excluded based on benchmark regression

@github-actions github-actions bot added the API14 Platform : Tizen 11.0 / TFM: net8.0-tizen11.0 label Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API14 Platform : Tizen 11.0 / TFM: net8.0-tizen11.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant