Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of text/template #138

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

AlexanderYastrebov
Copy link
Contributor

Use of text/template inhibits dead code elimination, see golang/go#62024

Building with go1.22.1 via go build -v -trimpath -ldflags '-d -w' results in binary size reduction from 2704725 to 1652718 bytes (-39%).

Use of text/template inhibits dead code elimination, see golang/go#62024

Building with go1.22.1 via `go build -v -trimpath -ldflags '-d -w'`
results in binary size reduction from 2704725 to 1652718 bytes (-39%).
@AlexanderYastrebov
Copy link
Contributor Author

Building with outdated go1.18.2 results in binary size reduction from 2351385 to 1495254 (-36%).

Copy link
Owner

@tianon tianon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!! I can't seem to recall why I used text/template here to begin with, but I'm certainly not attached to it and we can probably get more small gains from applying this same simplification logic to other parts of the code 😀

@tianon tianon merged commit a7a1ca6 into tianon:master Mar 20, 2024
1 check passed
@AlexanderYastrebov AlexanderYastrebov deleted the remove-template branch March 20, 2024 09:35
@AlexanderYastrebov
Copy link
Contributor Author

we can probably get more small gains from applying this same simplification logic to other parts of the code 😀

That's a tough call - the code is pretty slick 😄 Thank you for the utility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants