Example #1
0
func (bi *bitmapIndex) index(e *Entity) (err error) {
	if len(e.Tags) == 0 {
		return nil
	}
	a := &assign{bitset: adapters.NewBigIntBitset(),
		eID: e.h.entityID}
	var i int
	var ie bool
	for _, t := range e.Tags {
		// fmt.Printf("index %s\n", t)
		if ie, i = bi.searchTag(t); !ie {
			// fmt.Println("index", i)
			bi.tagPool = append(bi.tagPool, t)
			copy(bi.tagPool[i+1:], bi.tagPool[i:])
			bi.tagPool[i] = t
			//bi.tagPool = append(bi.tagPool, t)
			//i = len(bi.tagPool) - 1
		}
		a.bitset.Add(uint32(i))
	}
	bi.idx = append(bi.idx, a)
	return
}
Example #2
0
func BenchmarkAddContainsBigInt32bit(b *testing.B) {
	benchmarkAddContainsRemove(b, adapters.NewBigIntBitset(), prepareTestData(b.N, 4294967295))
}
Example #3
0
func BenchmarkAddContainsBigInt16bit(b *testing.B) {
	benchmarkAddContainsRemove(b, adapters.NewBigIntBitset(), prepareTestData(b.N, 65535))
}