项目作者: joaovicdsantos

项目描述 :
A program that calculates anagrams made in Go using the resources of concurrency.
高级语言: Go
项目地址: git://github.com/joaovicdsantos/anagrams.git
创建时间: 2021-01-10T20:40:58Z
项目社区:https://github.com/joaovicdsantos/anagrams

开源协议:MIT License

下载


" class="reference-link">Anagrams "golang version" Go Report Card

A program that calculates anagrams made in Go using the resources of concurrency.

When they act?

Goroutines are implemented when calculating anagram variations. In summary, for each letter in the word, the program will generate a process that will calculate the variants with that initial letter.

scheme of the program's operation

How to use

For a simple run, make sure you have “golang” installed on your machine and run the following command:

  1. budinha@budinha-pc:/anagrams/$ go run main.go golang

In addition, you can choose to compile the program and then run it. There is probably no performance improvement, as the go run command compiles to a temporary folder and executes the project. The advantage is that you will have an executable file instead of source code.

  1. budinha@budinha-pc:/anagrams/$ go build
  2. budinha@budinha-pc:/anagrams/$ ./anagrams golang

As Golang is beautiful, you can still install it on your pc (if you have GOPATH configured).

  1. budinha@budinha-pc:/anagrams/$ go install
  2. // restart the console and run anywhere
  3. budinha@budinha-pc:/anagrams/$ anagrams golang

Example

"example"

A comparison with obvious result

Some years ago I made this same code, or at least the same functionality, with the Python language. When I finished this program in Go, I decided to make a certain speed comparison. It is important to note that python code does not implement threads or anything like that. In the future, I intend to write a new code and redo this comparison (which probably won’t change the result, but it’s cool :P). Results:

video