what is the performance impact of golang maps

10,991

There are two separate issues here:

  1. What is the performance of a Go map?

An answer can be found in this issue

  1. What are the performance implication of 50,000 goroutines contending on a map.

This doesn't sound like a good idea, but you can never know without benchmarking. You might want to consider sending the map values asynchronously through a buffered channel, if you don't depend on the fact that the map value would be written immediately.

You might also want to check out concurrent-map which is solving a similar problem.

Share:
10,991

Related videos on Youtube

susheel chaudhary
Author by

susheel chaudhary

Updated on June 05, 2022

Comments

  • susheel chaudhary
    susheel chaudhary about 2 years

    In golang, maps implemented using hash tables .I am using locks of sync package for readinng and writing in maps. Is there any performance impact if 50,000 reqests try to access the map ? What is the order of reading/writing maps? Is it O(1)?