This repository has been archived by the owner on Dec 19, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is good for a lot of small files - fill the tree,
GOB encode, gzip then store as base64 in the source.
On init, the code decodes the base64, uncompresses, decodes,
then fills the names slice and the values map from the tree.
Benchmarks with the zoneinfo.zip:
$ rm zoneinfo/.go; time embedfiles -out zoneinfo/zi.go -pkg=tz -trie=false zoneinfo/ ; ls -l zoneinfo/.go
real 0m1,276s
user 0m1,599s
sys 0m0,033s
-rw-r--r-- 1 gthomas gthomas 2721295 jan 25 15:51 zoneinfo/zi.go
$ rm zoneinfo/.go; time embedfiles -out zoneinfo/zi.go -pkg=tz -trie=true zoneinfo/ ; ls -l zoneinfo/.go
real 0m0,045s
user 0m0,031s
sys 0m0,019s
-rw-r--r-- 1 gthomas gthomas 295428 jan 25 15:51 zoneinfo/zi.go
So a tenfold decrease in source size.