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

chore: optimize Terraform based change detection #1913

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

i4ki
Copy link
Contributor

@i4ki i4ki commented Oct 10, 2024

What this PR does / why we need it:

Memoize the Terraform modules already checked for changes.

Which issue(s) this PR fixes:

none

Special notes for your reviewer:

Does this PR introduce a user-facing change?

no

@i4ki i4ki changed the title I4k cache terraform change detection chore: optimize Terraform based change detection Oct 10, 2024
Copy link

github-actions bot commented Oct 10, 2024

2024/10/11 19:32:37 Terraform detected version: 1.9.7
toolsetPath: /tmp/cmd-terramate-test-3128631912
=== RUN   TestInteropCloudSyncPreview
=== RUN   TestInteropCloudSyncPreview/preview:_basic-drift
    interoperability_test.go:46: using GITHUB_EVENT_FILE=/home/runner/work/_temp/_github_workflow/event.json
=== RUN   TestInteropCloudSyncPreview/preview:_basic-drift-uppercase-id
    interoperability_test.go:46: using GITHUB_EVENT_FILE=/home/runner/work/_temp/_github_workflow/event.json
--- PASS: TestInteropCloudSyncPreview (12.20s)
    --- PASS: TestInteropCloudSyncPreview/preview:_basic-drift (6.28s)
    --- PASS: TestInteropCloudSyncPreview/preview:_basic-drift-uppercase-id (5.92s)
=== RUN   TestInteropSyncDeployment
=== RUN   TestInteropSyncDeployment/deployment:_empty
=== RUN   TestInteropSyncDeployment/deployment:_empty-uppercase-id
--- PASS: TestInteropSyncDeployment (37.65s)
    --- PASS: TestInteropSyncDeployment/deployment:_empty (18.61s)
    --- PASS: TestInteropSyncDeployment/deployment:_empty-uppercase-id (19.04s)
=== RUN   TestInteropDrift
=== RUN   TestInteropDrift/drift:_basic-drift
=== RUN   TestInteropDrift/drift:_basic-drift-uppercase-id
--- PASS: TestInteropDrift (58.75s)
    --- PASS: TestInteropDrift/drift:_basic-drift (29.64s)
    --- PASS: TestInteropDrift/drift:_basic-drift-uppercase-id (29.11s)
PASS
ok  	github.com/terramate-io/terramate/e2etests/cloud/interop	122.229s

Copy link

github-actions bot commented Oct 10, 2024

Preview of ubuntu-focal/go1.21 tests in b47f832

🔍 View Details on Terramate Cloud

stack
tf

Copy link

github-actions bot commented Oct 10, 2024

Preview of macos-ventura/go1.21 tests in b47f832

🔍 View Details on Terramate Cloud

stack
tf

Copy link

github-actions bot commented Oct 10, 2024

metric: time/op
ChangeDetection-4: old 3.93ms ± 3%: new 3.58ms ± 5%: delta: -8.92%
ChangeDetectionTFAndTG-4: old 12.7ms ± 3%: new 12.2ms ± 2%: delta: -4.33%
CloudReadLines-4: old 979µs ± 9%: new 986µs ± 8%: delta: 0.00%
CloudReadLine-4: old 7.10ms ± 4%: new 7.24ms ± 1%: delta: 1.95%
ListFiles-4: old 80.2µs ± 1%: new 80.4µs ± 1%: delta: 0.33%
Generate-4: old 4.93s ± 2%: new 5.00s ± 1%: delta: 1.41%
GenerateRegex-4: old 3.21s ± 1%: new 3.32s ± 2%: delta: 3.47%
TokensForExpressionComplex-4: old 1.25ms ± 0%: new 1.25ms ± 0%: delta: 0.29%
TokensForExpressionPlainStringNoNewline-4: old 784ns ± 1%: new 784ns ± 0%: delta: 0.00%
TokensForExpressionStringWith100Newlines-4: old 23.5µs ± 1%: new 23.4µs ± 1%: delta: -0.25%
TokensForExpressionObjectWith100KeysWithNumberValues-4: old 1.44ms ± 0%: new 1.44ms ± 0%: delta: 0.30%
TokensForExpression-4: old 1.25ms ± 0%: new 1.26ms ± 0%: delta: 0.58%
PartialEvalComplex-4: old 514µs ± 1%: new 522µs ± 2%: delta: 1.55%
PartialEvalSmallString-4: old 3.72µs ± 0%: new 3.73µs ± 1%: delta: 0.30%
PartialEvalHugeString-4: old 1.90ms ± 0%: new 1.91ms ± 0%: delta: 0.71%
PartialEvalHugeInterpolatedString-4: old 4.66ms ± 1%: new 4.78ms ± 3%: delta: 2.50%
PartialEvalObject-4: old 24.4µs ± 0%: new 25.0µs ± 1%: delta: 2.34%
TmAllTrueLiteralList-4: old 617µs ± 1%: new 618µs ± 0%: delta: 0.00%
TmAllTrueFuncall-4: old 20.3µs ± 0%: new 20.2µs ± 1%: delta: -0.37%
TmAnyTrueLiteralList-4: old 4.86ms ± 1%: new 4.83ms ± 0%: delta: -0.63%
TmAnyTrueFuncall-4: old 20.6µs ± 1%: new 20.5µs ± 1%: delta: -0.47%
TmTernary-4: old 2.58µs ± 0%: new 2.57µs ± 0%: delta: -0.32%
TmTryUnknownFunc-4: old 2.27µs ± 0%: new 2.26µs ± 0%: delta: -0.55%
TmTryUnknownVariable-4: old 2.18µs ± 0%: new 2.17µs ± 1%: delta: -0.50%
TmTryUnknownObjectKey-4: old 2.49µs ± 1%: new 2.48µs ± 0%: delta: -0.23%
metric: alloc/op
ChangeDetection-4: old 357kB ± 0%: new 300kB ± 0%: delta: -16.05%
ChangeDetectionTFAndTG-4: old 4.80MB ± 0%: new 4.76MB ± 0%: delta: -0.90%
CloudReadLines-4: old 3.12MB ± 0%: new 3.12MB ± 0%: delta: 0.00%
CloudReadLine-4: old 3.37MB ± 0%: new 3.37MB ± 0%: delta: 0.00%
ListFiles-4: old 27.6kB ± 0%: new 27.6kB ± 0%: delta: 0.00%
Generate-4: old 4.47GB ± 0%: new 4.47GB ± 0%: delta: 0.00%
GenerateRegex-4: old 1.84GB ± 0%: new 1.84GB ± 0%: delta: 0.00%
TokensForExpressionComplex-4: old 394kB ± 0%: new 394kB ± 0%: delta: 0.00%
TokensForExpressionPlainStringNoNewline-4: old 512B ± 0%: new 512B ± 0%: delta: 0.00%
TokensForExpressionStringWith100Newlines-4: old 12.5kB ± 0%: new 12.5kB ± 0%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-4: old 395kB ± 0%: new 395kB ± 0%: delta: 0.00%
TokensForExpression-4: old 394kB ± 0%: new 394kB ± 0%: delta: 0.00%
PartialEvalComplex-4: old 338kB ± 0%: new 338kB ± 0%: delta: 0.00%
PartialEvalSmallString-4: old 1.74kB ± 0%: new 1.74kB ± 0%: delta: 0.00%
PartialEvalHugeString-4: old 196kB ± 0%: new 196kB ± 0%: delta: 0.00%
PartialEvalHugeInterpolatedString-4: old 4.05MB ± 0%: new 4.05MB ± 0%: delta: 0.00%
PartialEvalObject-4: old 17.2kB ± 0%: new 17.2kB ± 0%: delta: 0.00%
TmAllTrueLiteralList-4: old 321kB ± 0%: new 321kB ± 0%: delta: 0.00%
TmAllTrueFuncall-4: old 10.6kB ± 0%: new 10.6kB ± 0%: delta: 0.00%
TmAnyTrueLiteralList-4: old 2.09MB ± 0%: new 2.09MB ± 0%: delta: 0.00%
TmAnyTrueFuncall-4: old 10.7kB ± 0%: new 10.7kB ± 0%: delta: 0.00%
TmTernary-4: old 1.20kB ± 0%: new 1.20kB ± 0%: delta: 0.00%
TmTryUnknownFunc-4: old 784B ± 0%: new 784B ± 0%: delta: 0.00%
TmTryUnknownVariable-4: old 768B ± 0%: new 768B ± 0%: delta: 0.00%
TmTryUnknownObjectKey-4: old 952B ± 0%: new 952B ± 0%: delta: 0.00%
metric: allocs/op
ChangeDetection-4: old 2.43k ± 0%: new 1.96k ± 0%: delta: -19.62%
ChangeDetectionTFAndTG-4: old 33.6k ± 0%: new 33.2k ± 0%: delta: -1.10%
CloudReadLines-4: old 5.54k ± 0%: new 5.54k ± 0%: delta: 0.00%
CloudReadLine-4: old 60.0k ± 0%: new 60.0k ± 0%: delta: 0.00%
ListFiles-4: old 335 ± 0%: new 335 ± 0%: delta: 0.00%
Generate-4: old 51.4M ± 0%: new 51.4M ± 0%: delta: 0.00%
GenerateRegex-4: old 36.8M ± 0%: new 36.8M ± 0%: delta: 0.00%
TokensForExpressionComplex-4: old 4.83k ± 0%: new 4.83k ± 0%: delta: 0.00%
TokensForExpressionPlainStringNoNewline-4: old 20.0 ± 0%: new 20.0 ± 0%: delta: 0.00%
TokensForExpressionStringWith100Newlines-4: old 227 ± 0%: new 227 ± 0%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-4: old 3.19k ± 0%: new 3.19k ± 0%: delta: 0.01%
TokensForExpression-4: old 4.83k ± 0%: new 4.83k ± 0%: delta: 0.00%
PartialEvalComplex-4: old 3.48k ± 0%: new 3.48k ± 0%: delta: 0.00%
PartialEvalSmallString-4: old 23.0 ± 0%: new 23.0 ± 0%: delta: 0.00%
PartialEvalHugeString-4: old 35.0 ± 0%: new 35.0 ± 0%: delta: 0.00%
PartialEvalHugeInterpolatedString-4: old 23.1k ± 0%: new 23.1k ± 0%: delta: 0.00%
PartialEvalObject-4: old 152 ± 0%: new 152 ± 0%: delta: 0.00%
TmAllTrueLiteralList-4: old 5.94k ± 0%: new 5.94k ± 0%: delta: 0.00%
TmAllTrueFuncall-4: old 275 ± 0%: new 275 ± 0%: delta: 0.00%
TmAnyTrueLiteralList-4: old 59.6k ± 0%: new 59.6k ± 0%: delta: 0.00%
TmAnyTrueFuncall-4: old 277 ± 0%: new 277 ± 0%: delta: 0.00%
TmTernary-4: old 28.0 ± 0%: new 28.0 ± 0%: delta: 0.00%
TmTryUnknownFunc-4: old 21.0 ± 0%: new 21.0 ± 0%: delta: 0.00%
TmTryUnknownVariable-4: old 20.0 ± 0%: new 20.0 ± 0%: delta: 0.00%
TmTryUnknownObjectKey-4: old 23.0 ± 0%: new 23.0 ± 0%: delta: 0.00%

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.

1 participant