Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
common
count
vendor
.gitignore
README.md
go.mod
go.sum
main.go
main_test.go

README.md

Words count

Run:

go run main.go -file=/path/to/file

Optimizations:

  • Read file concurrently in batchs per 2^19-1 bytes here
  • To get lowercase letter, add 32 to it's ASCII code here
  • Use read optimized lock free map to count words here
  • To sort words in the end, add a word to a slice where it's index == number of occurrences, then interate backwards and return first 10 words and it's indexes here
  • Count only most common words in the English language, because of the Law of large numbers here
You can’t perform that action at this time.