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

Low performance in deduplicate strings function #1311

Closed
AntoniJakubiak opened this issue Feb 8, 2024 · 4 comments
Closed

Low performance in deduplicate strings function #1311

AntoniJakubiak opened this issue Feb 8, 2024 · 4 comments

Comments

@AntoniJakubiak
Copy link

sort.Strings(s)

A typical implementation is:

input []string

m := make(map[string]bool, len(input))
for _, v := range input {
  m[v] = true
}
output := make(input, len(m))
i := 0
for v := range m {
 output[i] = v
 i++
}

@austinvalle
Copy link
Member

Hi there @AntoniJakubiak 👋🏻 ,

Can you provide some more detail about how this performance is affecting your usage of the github.com/hashicorp/terraform-plugin-sdk/terraform Go module?

From what I see, the function referenced is only called by the (terraform.State).Remove function

@AntoniJakubiak
Copy link
Author

Hi,

Sorry for bothering you. I thought, that I'm in the middle of different project.

;)

@austinvalle
Copy link
Member

No problem @AntoniJakubiak!

Copy link

I'm going to lock this issue 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 similar to this, 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 Mar 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants