| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Move Octicon base64 encoding to the generation script and embed the generated lookup manifest for zero-allocation reads. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5557f448-5cc1-46ce-b5ad-36f9e2e224e0
There was a problem hiding this comment.
Precomputes Octicon data URIs during icon generation, replacing runtime encoding with fast map lookups.
Changes:
| File | Description |
|---|---|
| script/fetch-icons | Generates the data URI manifest. |
| pkg/octicons/octicons.go | Loads manifest and provides map-based lookup. |
| pkg/octicons/octicons_test.go | Verifies URI correctness and coverage. |
| pkg/octicons/octicons_benchmark_test.go | Benchmarks lookup and icon creation. |
| pkg/octicons/icons_data_uris.txt | Stores generated PNG data URIs. |
Sorry, something went wrong.
| # Generates both light theme (dark icons) and dark theme (white icons) variants. | ||
| # Uses sed to modify SVG fill color before converting to PNG. | ||
| # Requires: rsvg-convert (from librsvg2-bin on Ubuntu/Debian) | ||
| # Requires: rsvg-convert (from librsvg2-bin on Ubuntu/Debian), base64 |
| Back | FazBrowse Home | New Git URL |
Summary
Supersedes #2851. Thanks @dexhunter for identifying the repeated encoding overhead and proposing the caching improvement; this moves that work to generation time instead.
The original uncached/cold lookup was about 4162 ns/op, 8874 B/op, 13 allocs/op. The generated lookup is about 26 ns/op, 0 B/op, 0 allocs/op. This trades roughly 48 KB of embedded data for eliminating runtime base64 work and synchronization.
The remote server's wrapper can continue checking remote-specific icons first and falling back to this OSS package, preserving its existing extension model.
Fixes #2850