Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joaovicdsantos/anagrams
A program that calculates anagrams made in Go using the resources of concurrency.
https://github.com/joaovicdsantos/anagrams
anagrams combinatorial-analysis concurrency golang goroutines
Last synced: 8 days ago
JSON representation
A program that calculates anagrams made in Go using the resources of concurrency.
- Host: GitHub
- URL: https://github.com/joaovicdsantos/anagrams
- Owner: joaovicdsantos
- License: mit
- Created: 2021-01-10T20:40:58.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-12T14:53:56.000Z (almost 4 years ago)
- Last Synced: 2024-06-20T11:12:45.153Z (5 months ago)
- Topics: anagrams, combinatorial-analysis, concurrency, golang, goroutines
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Anagrams !["golang version"](https://img.shields.io/badge/golang-v1.15.6-green) [![Go Report Card](https://goreportcard.com/badge/github.com/joaovicdsantos/anagrams)](https://goreportcard.com/report/github.com/joaovicdsantos/anagrams)
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.
## How to use
For a simple run, make sure you have "golang" installed on your machine and run the following command:
```console
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.
```console
budinha@budinha-pc:/anagrams/$ go build
budinha@budinha-pc:/anagrams/$ ./anagrams golang
```
As Golang is beautiful, you can still install it on your pc (if you have GOPATH configured).
```console
budinha@budinha-pc:/anagrams/$ go install
// restart the console and run anywhere
budinha@budinha-pc:/anagrams/$ anagrams golang
```## Example
!["example"](https://media.giphy.com/media/mV8yyjfJ7viSrCPwg1/giphy.gif)## 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](https://img.youtube.com/vi/DO3WUEi7AIM/0.jpg)](https://www.youtube.com/watch?v=DO3WUEi7AIM)