Commit 7a9eb52
committed
⚡ [perf] Improves module loading and execution speed
Improves the module's performance by optimizing configuration handling, script inventory, and metadata loading, and introduces a performance playbook.
- ⚡ [perf] Implements lazy loading for cache and configuration:
- - Initializes the cache directory and loads configuration only when needed, avoiding unnecessary overhead during module import.
- ⚡ [perf] Optimizes configuration saving:
- - Adds a check to prevent writing configuration if the content hasn't changed, reducing disk I/O.
- ⚡ [perf] Enhances script inventory management:
- - Caches script inventory and reuses record objects to avoid rescanning the scripts directory on warm calls.
- - Adds function to reset the script inventory cache.
- ⚡ [perf] Improves metadata loading and caching:
- - Adds support for JSON-based metadata cache file for faster subsequent loads.
- - Uses .NET file methods for faster file existence checks and modification time retrieval.
- ⚡ [perf] Optimizes script execution and output handling:
- - Introduces `Test-ColorScriptTextEmission` to determine when to emit text, reducing overhead when output is redirected or not needed.
- 🛠️ [fix] Fixes a regex in `Show-ColorScriptHelp` to correctly match parameter metadata lines.
- 🛠️ [fix] Corrects an issue where the configuration root path could be improperly determined if XDG_CONFIG_HOME was empty.
- 🚜 [refactor] Refactors `Copy-ColorScriptHashtable` and `Merge-ColorScriptConfiguration` to use `System.Collections.IDictionary` instead of `hashtable` for broader compatibility and adds cloning for arrays and ICloneable objects.
- 📝 [docs] Adds a `PERFORMANCE_IMPROVEMENTS.md` file, detailing performance objectives, optimizations, startup timeline, measurement playbook, usage recommendations, maintenance checklist, and future opportunities.
- 🧹 [chore] Updates the linting script to resolve paths and handle potential `NullReferenceException` during analysis.
- 🧹 [chore] Renames an ANSI file to correct character encoding.
Signed-off-by: Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com>1 parent 89be5fa commit 7a9eb52
14 files changed
Lines changed: 570 additions & 92 deletions
File tree
- ColorScripts-Enhanced
- docs
- assets/unused-ansi-files
- docs
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
0 commit comments