예제 #1
0
func getListOfCodecs() (map[string]encoding.Integer, error) {
	codecs := make(map[string]encoding.Integer, 10)

	for _, codec := range codecsParam {
		switch codec {
		case "bp32":
			codecs["bp32"] = composition.New(bp32.New(), variablebyte.New())
		case "fastpfor":
			codecs["fastpfor"] = composition.New(fastpfor.New(), variablebyte.New())
		case "variablebyte":
			codecs["variablebyte"] = variablebyte.New()
		case "deltabp32":
			codecs["delta bp32"] = composition.New(dbp32.New(), dvb.New())
		case "deltafastpfor":
			codecs["delta fastpfor"] = composition.New(dfastpfor.New(), dvb.New())
		case "deltavariablebyte":
			codecs["delta variablebyte"] = dvb.New()
		case "zigzagbp32":
			codecs["zigzag bp32"] = composition.New(zbp32.New(), dvb.New())
		case "zigzagfastpfor":
			codecs["zigzag fastpfor"] = composition.New(zfastpfor.New(), dvb.New())
		}
	}

	if len(codecs) < 1 {
		return nil, fmt.Errorf("benchmark/getListOfCodecs: No codecs defined")
	}

	return codecs, nil
}
예제 #2
0
// Compress compresses in[]int32 to out[]int32
func Compress32(in []int32) (out []int32, err error) {
	out = make([]int32, len(in)*2)
	inpos := cursor.New()
	outpos := cursor.New()

	if err = bp32.New().Compress(in, inpos, len(in), out, outpos); err != nil {
		return nil, err
	}

	return out[:outpos.Get()], nil
}
예제 #3
0
// Uncompress uncompresses in[]int32 to out[]int32
func Uncompress32(in []int32, buffer []int32) (out []int32, err error) {
	out = buffer
	inpos := cursor.New()
	outpos := cursor.New()

	if err = bp32.New().Uncompress(in, inpos, len(in), out, outpos); err != nil {
		return nil, err
	}

	return out[:outpos.Get()], nil
}
예제 #4
0
func TestDeltaBP32andDeltaVariableByte(t *testing.T) {
	sizes := []int{100, 100 * 10, 100 * 100, 100 * 1000, 100 * 10000}
	benchtools.TestCodec(New(dbp32.New(), dvb.New()), data, sizes)
}