mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-13 09:32:24 -06:00
4e42d21837
* Optimize (m ModuleInstance) String() Optimize (m ModuleInstance) String() to preallocate the buffer and use strings.Builder instead of bytes.Buffer This leads to a common case only doing a single allocation as opposed to a few allocations which the bytes.Buffer is doing. * adding a benchmark test Result: ``` $ go test -bench=String ./addrs -benchmem BenchmarkStringShort-12 18271692 56.52 ns/op 16 B/op 1 allocs/op BenchmarkStringLong-12 8057071 158.5 ns/op 96 B/op 1 allocs/op PASS $ git checkout main addrs/module_instance.go $ go test -bench=String ./addrs -benchmem BenchmarkStringShort-12 7690818 162.0 ns/op 80 B/op 2 allocs/op BenchmarkStringLong-12 2922117 414.1 ns/op 288 B/op 3 allocs/op ``` * Update module_instance_test.go switch spaces to tabs |
||
---|---|---|
.. | ||
count_attr.go | ||
doc.go | ||
for_each_attr.go | ||
input_variable.go | ||
instance_key.go | ||
local_value.go | ||
module_call.go | ||
module_instance_test.go | ||
module_instance.go | ||
module_test.go | ||
module.go | ||
output_value_test.go | ||
output_value.go | ||
parse_ref_test.go | ||
parse_ref.go | ||
parse_target_test.go | ||
parse_target.go | ||
path_attr.go | ||
provider_config_test.go | ||
provider_config.go | ||
provider_test.go | ||
provider.go | ||
referenceable.go | ||
resource_phase.go | ||
resource_test.go | ||
resource.go | ||
resourcemode_string.go | ||
self.go | ||
target_test.go | ||
targetable.go | ||
terraform_attr.go |