-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeGarbageCollectorNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.Performance
Milestone
Description
Duplicate strings can waste memory and cause lots of allocations, but may be cheaper at allocation time. Interning strings has a lookup cost, but can save memory and even CPU by reduced number of GCs. I'd like to have this choice, for when I know my strings are large and likely duplicates. Manual interning in user code, var internedStrings struct{ sync.RWMutex m map[string]string } ... leads to lock contention and a map that grows forever. The runtime could have a less contentious map and could integrate with the garbage collector, such that strings that are only referenced from the intern table to themselves are still collected and removed from the internal map.
valyala, tve, hooluupog, 2opremio, redbaron and 6 more
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeGarbageCollectorNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.Performance