Optimize themes.py: 42% faster with hash caching and reduced I/O#702
Optimize themes.py: 42% faster with hash caching and reduced I/O#702
Conversation
Co-authored-by: GilbN <24592972+GilbN@users.noreply.github.com>
Co-authored-by: GilbN <24592972+GilbN@users.noreply.github.com>
Co-authored-by: GilbN <24592972+GilbN@users.noreply.github.com>
Co-authored-by: GilbN <24592972+GilbN@users.noreply.github.com>
Co-authored-by: GilbN <24592972+GilbN@users.noreply.github.com>
Co-authored-by: GilbN <24592972+GilbN@users.noreply.github.com>
|
@copilot If themes.json and this css/base//.css |
The .gitignore file only affects git tracking in the master/develop branches, not the CI/CD deployment process. Here's how it works:
The .gitignore ensures these generated files aren't committed to master/develop (keeping the repo clean), while the deployment action still picks them up from the filesystem and publishes them to the live branches. You can verify this: the generated files exist in the working directory after themes.py runs, they're just not tracked by git. |
The
themes.pyscript performed 4,535 MD5 hash operations and 4,486getcwd()calls to generate 2,378 CSS files, with 90% of runtime spent repeatedly hashing the same files.Changes
Hash Caching
_hash_cachedict to memoize MD5 results, reducing hash operations from 4,535 to 364 (92% reduction)System Call Reduction
getcwd()result, eliminating 4,485 redundant callsList Comprehension Optimization
file.split(".")[1] == "css"withfile.endswith('.css')Repository Hygiene
.gitignore(themes.json, css/base//.css excluding *-base.css)Performance
Example
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.