Skip to content

Commit

Permalink
Merge pull request #39569 from hashicorp/td-schema-memory-usage
Browse files Browse the repository at this point in the history
provider: Reduce schema memory usage by 18 MB
  • Loading branch information
gdavison authored Oct 4, 2024
2 parents 4182de0 + dd24b1a commit 943284e
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 202 deletions.
2 changes: 1 addition & 1 deletion internal/provider/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/terraform-provider-aws/internal/provider"
)

// go test -bench=BenchmarkProtoV5ProviderServerFactory -benchtime 1x -benchmem -run=B -v ./internal/provider
// go test -bench=BenchmarkProtoV5ProviderServerFactory -benchtime 1x -benchmem -run=Bench -v ./internal/provider
func BenchmarkProtoV5ProviderServerFactory(b *testing.B) {
_, p, err := provider.ProtoV5ProviderServerFactory(context.Background())

Expand Down
10 changes: 10 additions & 0 deletions internal/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ import (
"github.com/hashicorp/terraform-provider-aws/names"
)

// go test -bench=BenchmarkSDKProviderInitialization -benchmem -run=Bench -v ./internal/provider
func BenchmarkSDKProviderInitialization(b *testing.B) {
for n := 0; n < b.N; n++ {
_, err := New(context.Background())
if err != nil {
b.Fatal(err)
}
}
}

func TestProvider(t *testing.T) {
t.Parallel()

Expand Down
4 changes: 2 additions & 2 deletions internal/service/ec2/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ func tagsFromTagDescriptions(tds []awstypes.TagDescription) []awstypes.Tag {
}

func tagsSchemaConflictsWith(conflictsWith []string) *schema.Schema {
v := tftags.TagsSchema()
v := *tftags.TagsSchema() // nosemgrep:ci.semgrep.aws.prefer-pointer-conversion-assignment
v.ConflictsWith = conflictsWith

return v
return &v
}
Loading

0 comments on commit 943284e

Please sign in to comment.