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

language_detect:chore - remove redundant code #893

Merged
merged 1 commit into from
Dec 27, 2021

Conversation

matheusalcantarazup
Copy link
Contributor

Previously during the walk path, for each path visited, before append
the new path on the list of paths we were always checking for duplicate
values, which make a redundant operation, since this check can be only
be done once. Before return the languages we was checking for duplicate
languages (again) and also converting the languages from string to
languages.Language and checking if their supported, which add another
redundant loop on languages.Values(), since we can only ignore unknown
languages during the parsing.

This commit remove this redundant code by checking only once for
duplicate languages, and ignoring languages.Unknown during
parsing/appending to all languages list.

Signed-off-by: Matheus Alcantara [email protected]

- What I did

- How to verify it

- Description for the changelog

Previously during the walk path, for each path visited, before append
the new path on the list of paths we were always checking for duplicate
values, which make a redundant operation, since this check can be only
be done once. Before return the languages we was checking for duplicate
languages (again) and also converting the languages from string to
`languages.Language` and checking if their supported, which add another
redundant loop on `languages.Values()`, since we can only ignore unknown
languages during the parsing.

This commit remove this redundant code by checking only once for
duplicate languages, and ignoring `languages.Unknown` during
parsing/appending to all languages list.

Signed-off-by: Matheus Alcantara <[email protected]>
@wiliansilvazup wiliansilvazup merged commit d358b62 into main Dec 27, 2021
@wiliansilvazup wiliansilvazup deleted the improve-languade-detect branch December 27, 2021 10:05
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.

3 participants