Any help why there is same performance with and without concurrent code

package main

import (




func measureTime(str string) func() {

start := time.Now()

return func() {

    fmt.Printf("%s took  %v time for execution\n", str, time.Since(start))



// Sequential uses a sequential algorithm.

func Sequential(words []string) map[rune]int { //array of strings simple solutions

m := make(map[rune]int)

for _, word := range words {

    for _, c := range word {




return m


// ConcurrentUnlimited uses a concurrent algorithm based on an

// unlimited fan out pattern.

func Concurrent(text []string) map[rune]int {

ch := make(chan map[rune]int, len(text))

for _, words := range text {

    go func(words string) {

        lm := make(map[rune]int)

        for _, r := range words {



        ch <- lm



all := make(map[rune]int)

for range text {

    lm := <-ch

    for r, c := range lm {

        all[r] += c



return all


func main() {

defer measureTime("freq")()

var words []string = []string{"there is solution to every problems"}

//  words :=make([]string,5)

//  words = "there is solution to every problems"

//ret :=Sequential(words)528.9us

ret := Concurrent(words)//517.8us


//  }why the hell both are same in performance

// }


Hi @mohammed_yaqub,

I came across your post only now, I hope my input is still useful.

Without deeper analysis, I would guess that the last loop in Concurrent() takes about the same time as the loop in Sequential().

In fact, this loop is even a nested loop while the sequential one is not, which makes me wonder why Concurrent is actually not slower.

Another thought: The test input is quite a short string. If you try with a much longer string (really, much, much longer), you might get a more accurate measurement.