diff --git a/cmd/tools/cli/benchmark/core/main.go b/cmd/tools/cli/benchmark/core/main.go index 9a97418b2e..b715aa738d 100644 --- a/cmd/tools/cli/benchmark/core/main.go +++ b/cmd/tools/cli/benchmark/core/main.go @@ -288,7 +288,7 @@ func main() { }) ids := make([]uint, len(vectors)) - run(ctx, false, path, len(vectors[0]), vectors, ids, time.Hour*2, output) + run(ctx, false, path, len(vectors[0]), vectors, ids, time.Hour*1, output) sleep(ctx, time.Second*5, time.Minute*4, func() { output("waiting for next") }, func() { @@ -298,15 +298,15 @@ func main() { output("starting") }) run(ctx, true, path, len(vectors[0]), nil, nil, 0, output) - sleep(ctx, time.Second*5, time.Minute*4, func() { - output("waiting for next") - }, func() { - runtime.GC() - output("gc") - time.Sleep(time.Minute) - output("starting") - }) - run(ctx, true, path, len(vectors[0]), vectors, ids, time.Hour*2, output) + // sleep(ctx, time.Second*5, time.Minute*4, func() { + // output("waiting for next") + // }, func() { + // runtime.GC() + // output("gc") + // time.Sleep(time.Minute) + // output("starting") + // }) + // run(ctx, true, path, len(vectors[0]), vectors, ids, time.Hour*2, output) ids = ids[:0:0] ids = nil diff --git a/internal/core/algorithm/ngt/ngt.go b/internal/core/algorithm/ngt/ngt.go index 557bbb49a7..4d4d227c18 100644 --- a/internal/core/algorithm/ngt/ngt.go +++ b/internal/core/algorithm/ngt/ngt.go @@ -517,18 +517,16 @@ func (n *ngt) Insert(vec []float32) (id uint, err error) { } dim := C.uint32_t(n.dimension) cvec := (*C.float)(&vec[0]) - ebuf := n.GetErrorBuffer() n.lock(true) - oid := C.ngt_insert_index_as_float(n.index, cvec, dim, ebuf) + oid := C.ngt_insert_index_as_float(nil, cvec, dim, nil) n.unlock(true) id = uint(oid) cvec = nil vec = vec[:0:0] vec = nil if id == 0 { - return 0, n.newGoError(ebuf) + return 0, errors.Errorf("Insert Error") } - n.PutErrorBuffer(ebuf) n.cnt.Add(1) return id, nil @@ -622,14 +620,12 @@ func (n *ngt) CreateIndex(poolSize uint32) error { if poolSize == 0 { poolSize = n.poolSize } - ebuf := n.GetErrorBuffer() n.lock(true) - ret := C.ngt_create_index(n.index, C.uint32_t(poolSize), ebuf) + ret := C.ngt_create_index(nil, C.uint32_t(poolSize), nil) n.unlock(true) if ret == ErrorCode { - return n.newGoError(ebuf) + return errors.Errorf("CreateIndex Error") } - n.PutErrorBuffer(ebuf) return nil } @@ -672,14 +668,12 @@ func (n *ngt) SaveIndexWithPath(idxPath string) error { // Remove removes from NGT index. func (n *ngt) Remove(id uint) error { - ebuf := n.GetErrorBuffer() n.lock(true) - ret := C.ngt_remove_index(n.index, C.ObjectID(id), ebuf) + ret := C.ngt_remove_index(nil, C.ObjectID(id), nil) n.unlock(true) if ret == ErrorCode { - return n.newGoError(ebuf) + return errors.Errorf("Remove Error") } - n.PutErrorBuffer(ebuf) n.cnt.Add(^uint64(0))