I need use a very large map in a function and the function will be repeatedly called many times.
At the beginning of the function, the map need be empty.
One way to do it is to use/reuse just one permanent map object and clear it at the beginning of the function.
Another way is to create a new map object in the function.
Since the map is very large, I'd like to save some memory and keep the burden on GC low.
So I guess the first way is preferred. But I am not sure whether clearing a map and reusing it is really memory-efficient
compared to creating a new map object in each call. It depends on how map is implemented internally.
Any ideas and suggestions ?
Thanks !
Zhang Lei
Baidu, Inc.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.