FAQ

Am Freitag, 16. November 2012 18:08:57 UTC+1 schrieb Greg Ward:
...so the cost of copying one single node is pretty small. But I'm
worried about the overhead when there are thousands of nodes kicking
around.
Do not worry if there is no problem. If there is a problem:
Measure with pprof and get rid of the problem.
I would not pre-optimize such stuff without actual need.


The obvious overhead is the cost of copying bytes in memory. But
should I also be worried about allocation costs and the impact on GC?
My gut instinct says yes, but I'm unclear on the details. Has anyone
written a guide about when/why/how to worry about allocation and GC
overhead?
Again: Do not worry too much about something which might not be
an issue. One of my packages was dealing with XML manipulations
and allocated and dropped lots of small node structures. It was half a
day work to get rid of 30% of these allocations and subsequent
garbage collection by using the leaky buffer of effective Go:
http://golang.org/doc/effective_go.html#leaky_buffer
These 30% reuse could be made better, but it was not worth the
effort as other stuff got limiting. That's why I would suggest measuring
instead of worrying :-)

Volker

--

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 4 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 16, '12 at 5:08p
activeNov 25, '12 at 8:04p
posts4
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase