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

Disable bashlog.sh unless TFENV_DEBUG is higher than 0 #312

Closed
wants to merge 1 commit into from
Closed

Disable bashlog.sh unless TFENV_DEBUG is higher than 0 #312

wants to merge 1 commit into from

Conversation

reegnz
Copy link
Contributor

@reegnz reegnz commented Dec 14, 2021

Bashlog puts an unnecessary overhead on all terraform commands.
If debug is not enabled, don't use bashlog, use a more lightweight
log function instead.

Fixes #196 and #229

Bashlog puts an unnecessary overhead on all terraform commands.
If debug is not enabled, don't use bashlog, use a more lightweight
log function instead.

Fixes #196 and #229
@reegnz
Copy link
Contributor Author

reegnz commented Dec 14, 2021

Benchmarks

Before

time ./terraform -version
Terraform v1.1.0
on darwin_amd64
./terraform -version  0.44s user 0.49s system 62% cpu 1.492 total

After

time ./terraform -version
Terraform v1.1.0
on darwin_amd64
./terraform -version  0.06s user 0.04s system 77% cpu 0.130 total

I also made sure to keep the color coding of the log levels.

@reegnz
Copy link
Contributor Author

reegnz commented Dec 14, 2021

@Zordrak can you please have a look? This issue has been plaguing quite a lot of people so it would be great to deal with this soon.

I also am preparing a fix for bashlog which would be equivalent to this change in performance.

@reegnz
Copy link
Contributor Author

reegnz commented Dec 14, 2021

I also prepared #313 which is probably better than this one, as that is definitely backward-compatible (so no major version bump needed).

@reegnz
Copy link
Contributor Author

reegnz commented Jan 11, 2022

I'm closing this in favour of #313

@reegnz reegnz closed this Jan 11, 2022
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.

terraform executions delayed by ~ 1 second
1 participant