Skip to content

Commit 7a9eb52

Browse files
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

ColorScripts-Enhanced/ColorScripts-Enhanced.psd1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
#
44
# Generated by: Nick2bad4u
55
#
6-
# Generated on: 10/17/2025
6+
# Generated on: 10/20/2025
77
#
88

99
@{
1010
# Script module or binary module file associated with this manifest.
1111
RootModule = 'ColorScripts-Enhanced.psm1'
1212

1313
# Version number of this module.
14-
ModuleVersion = '2025.10.17.1700'
14+
ModuleVersion = '2025.10.20.1440'
1515

1616
# Supported PSEditions
1717
CompatiblePSEditions = @('Desktop', 'Core')
@@ -172,7 +172,7 @@ Full documentation: https://github.com/Nick2bad4u/ps-color-scripts-enhanced
172172

173173
# ReleaseNotes of this module
174174
ReleaseNotes = @'
175-
Version 2025.10.17.1700:
175+
Version 2025.10.20.1440:
176176
- Enhanced caching system with OS-wide cache in AppData
177177
- 6-19x performance improvement
178178
- Cache stored in centralized location

0 commit comments

Comments
 (0)