mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
save space when union-ing DistinctTimestamps
By using an empty struct, we reduce memory usage by up to 16 bytes (the size of a timestamp string)
This commit is contained in:
parent
f5c3c44411
commit
96df2700fd
1 changed files with 3 additions and 3 deletions
|
|
@ -1617,12 +1617,12 @@ func (d DistinctTimestamp) ToRows(callback func(*proto.RowResponse) error) error
|
|||
|
||||
// Union returns the union of the values of `d` and `other`
|
||||
func (d *DistinctTimestamp) Union(other DistinctTimestamp) DistinctTimestamp {
|
||||
both := map[string]string{}
|
||||
both := map[string]struct{}{}
|
||||
for _, val := range d.Values {
|
||||
both[val] = val
|
||||
both[val] = struct{}{}
|
||||
}
|
||||
for _, val := range other.Values {
|
||||
both[val] = val
|
||||
both[val] = struct{}{}
|
||||
}
|
||||
vals := []string{}
|
||||
for key := range both {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue