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

Reduce CPU usage via custom Copy methods instead reflection #513

Merged
merged 1 commit into from
May 26, 2021

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented May 17, 2021

Depends on hashicorp/hcl-lang#40
Depends on hashicorp/terraform-schema#44

Closes #509


The rationale and more context is described in #509 - I can estimate that this will reduce the CPU usage in the hot path (state manipulation) by ~66% (from ~3sec to ~1sec in my configuration) based on this snapshot of a CPU profile collected from a build based on this PR:

Screenshot 2021-05-17 at 20 43 29

The "new" bottleneck is JSON decoding, which is something we could address via #506

@radeksimko radeksimko added the enhancement New feature or request label May 17, 2021
@radeksimko radeksimko force-pushed the f-copy-funcs branch 2 times, most recently from d74a943 to 7ee84bb Compare May 18, 2021 07:08
@radeksimko radeksimko changed the title Decrease CPU usage by using custom Copy methods instead reflection Reduce CPU usage via custom Copy methods instead reflection May 18, 2021
@radeksimko radeksimko requested a review from a team May 18, 2021 09:52
Copy link
Contributor

@aeschright aeschright left a comment

Choose a reason for hiding this comment

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

👍

@radeksimko radeksimko merged commit d90a40f into main May 26, 2021
@radeksimko radeksimko deleted the f-copy-funcs branch May 26, 2021 09:27
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce CPU usage by implementing custom Copy funcs for schema
2 participants