mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-02-02 01:06:41 +08:00
enhance: reduce cpp ut test cost time (#34414)
#34413 cherry-pick part from master commit: pr: #33358 Signed-off-by: luzhang <luzhang@zilliz.com> Co-authored-by: luzhang <luzhang@zilliz.com>
This commit is contained in:
parent
b402485292
commit
190a2ca7b8
@ -84,7 +84,7 @@ class TaskTest : public testing::TestWithParam<DataType> {
|
||||
schema->set_primary_field_id(str1_fid);
|
||||
|
||||
auto segment = CreateSealedSegment(schema);
|
||||
size_t N = 1000000;
|
||||
size_t N = 10000;
|
||||
num_rows_ = N;
|
||||
auto raw_data = DataGen(schema, N);
|
||||
auto fields = schema->get_fields();
|
||||
@ -131,7 +131,7 @@ TEST_P(TaskTest, UnaryExpr) {
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
"test1",
|
||||
segment_.get(),
|
||||
1000000,
|
||||
num_rows_,
|
||||
MAX_TIMESTAMP,
|
||||
std::make_shared<milvus::exec::QueryConfig>(
|
||||
std::unordered_map<std::string, std::string>{}));
|
||||
@ -175,7 +175,7 @@ TEST_P(TaskTest, LogicalExpr) {
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
"test1",
|
||||
segment_.get(),
|
||||
1000000,
|
||||
num_rows_,
|
||||
MAX_TIMESTAMP,
|
||||
std::make_shared<milvus::exec::QueryConfig>(
|
||||
std::unordered_map<std::string, std::string>{}));
|
||||
@ -232,7 +232,7 @@ TEST_P(TaskTest, CompileInputs_and) {
|
||||
auto expr7 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::And, expr3, expr6);
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
DEAFULT_QUERY_ID, segment_.get(), 1000000, MAX_TIMESTAMP);
|
||||
DEAFULT_QUERY_ID, segment_.get(), num_rows_, MAX_TIMESTAMP);
|
||||
auto exprs = milvus::exec::CompileInputs(expr7, query_context.get(), {});
|
||||
EXPECT_EQ(exprs.size(), 4);
|
||||
for (int i = 0; i < exprs.size(); ++i) {
|
||||
@ -274,7 +274,7 @@ TEST_P(TaskTest, CompileInputs_or_with_and) {
|
||||
auto expr6 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::And, expr1, expr2);
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
DEAFULT_QUERY_ID, segment_.get(), 1000000, MAX_TIMESTAMP);
|
||||
DEAFULT_QUERY_ID, segment_.get(), num_rows_, MAX_TIMESTAMP);
|
||||
auto expr7 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::Or, expr3, expr6);
|
||||
auto exprs =
|
||||
@ -308,7 +308,7 @@ TEST_P(TaskTest, CompileInputs_or_with_and) {
|
||||
auto expr6 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::And, expr1, expr2);
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
DEAFULT_QUERY_ID, segment_.get(), 1000000, MAX_TIMESTAMP);
|
||||
DEAFULT_QUERY_ID, segment_.get(), num_rows_, MAX_TIMESTAMP);
|
||||
auto expr7 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::Or, expr3, expr6);
|
||||
auto exprs =
|
||||
@ -345,7 +345,7 @@ TEST_P(TaskTest, CompileInputs_or_with_and) {
|
||||
auto expr6 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::And, expr1, expr2);
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
DEAFULT_QUERY_ID, segment_.get(), 1000000, MAX_TIMESTAMP);
|
||||
DEAFULT_QUERY_ID, segment_.get(), num_rows_, MAX_TIMESTAMP);
|
||||
auto expr7 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::And, expr3, expr6);
|
||||
auto exprs =
|
||||
|
||||
@ -1271,7 +1271,7 @@ TEST(Expr, TestExprPerformance) {
|
||||
{DataType::DOUBLE, double_fid}};
|
||||
|
||||
auto seg = CreateSealedSegment(schema);
|
||||
int N = 1000000;
|
||||
int N = 10000;
|
||||
auto raw_data = DataGen(schema, N);
|
||||
|
||||
// load field data
|
||||
@ -1678,7 +1678,7 @@ TEST_P(ExprTest, TestSealedSegmentGetBatchSize) {
|
||||
schema->set_primary_field_id(str1_fid);
|
||||
|
||||
auto seg = CreateSealedSegment(schema);
|
||||
int N = 1000000;
|
||||
int N = 40000;
|
||||
auto raw_data = DataGen(schema, N);
|
||||
// load field data
|
||||
auto fields = schema->get_fields();
|
||||
@ -1739,7 +1739,7 @@ TEST_P(ExprTest, TestGrowingSegmentGetBatchSize) {
|
||||
schema->set_primary_field_id(str1_fid);
|
||||
|
||||
auto seg = CreateGrowingSegment(schema, empty_index_meta);
|
||||
int N = 1000000;
|
||||
int N = 400000;
|
||||
auto raw_data = DataGen(schema, N);
|
||||
seg->PreInsert(N);
|
||||
seg->Insert(0,
|
||||
@ -1804,7 +1804,7 @@ TEST_P(ExprTest, TestConjuctExpr) {
|
||||
schema->set_primary_field_id(str1_fid);
|
||||
|
||||
auto seg = CreateSealedSegment(schema);
|
||||
int N = 1000000;
|
||||
int N = 10000;
|
||||
auto raw_data = DataGen(schema, N);
|
||||
// load field data
|
||||
auto fields = schema->get_fields();
|
||||
@ -1871,7 +1871,7 @@ TEST_P(ExprTest, TestUnaryBenchTest) {
|
||||
schema->set_primary_field_id(str1_fid);
|
||||
|
||||
auto seg = CreateSealedSegment(schema);
|
||||
int N = 1000000;
|
||||
int N = 10000;
|
||||
auto raw_data = DataGen(schema, N);
|
||||
|
||||
// load field data
|
||||
@ -1942,7 +1942,7 @@ TEST_P(ExprTest, TestBinaryRangeBenchTest) {
|
||||
schema->set_primary_field_id(str1_fid);
|
||||
|
||||
auto seg = CreateSealedSegment(schema);
|
||||
int N = 1000000;
|
||||
int N = 10000;
|
||||
auto raw_data = DataGen(schema, N);
|
||||
|
||||
// load field data
|
||||
@ -2022,7 +2022,7 @@ TEST_P(ExprTest, TestLogicalUnaryBenchTest) {
|
||||
schema->set_primary_field_id(str1_fid);
|
||||
|
||||
auto seg = CreateSealedSegment(schema);
|
||||
int N = 1000000;
|
||||
int N = 10000;
|
||||
auto raw_data = DataGen(schema, N);
|
||||
|
||||
// load field data
|
||||
@ -2096,7 +2096,7 @@ TEST_P(ExprTest, TestBinaryLogicalBenchTest) {
|
||||
schema->set_primary_field_id(str1_fid);
|
||||
|
||||
auto seg = CreateSealedSegment(schema);
|
||||
int N = 1000000;
|
||||
int N = 10000;
|
||||
auto raw_data = DataGen(schema, N);
|
||||
|
||||
// load field data
|
||||
@ -2180,7 +2180,7 @@ TEST_P(ExprTest, TestBinaryArithOpEvalRangeBenchExpr) {
|
||||
schema->set_primary_field_id(str1_fid);
|
||||
|
||||
auto seg = CreateSealedSegment(schema);
|
||||
int N = 1000000;
|
||||
int N = 10000;
|
||||
auto raw_data = DataGen(schema, N);
|
||||
|
||||
// load field data
|
||||
@ -2263,7 +2263,7 @@ TEST_P(ExprTest, TestCompareExprBenchTest) {
|
||||
schema->set_primary_field_id(str1_fid);
|
||||
|
||||
auto seg = CreateSealedSegment(schema);
|
||||
int N = 1000000;
|
||||
int N = 10000;
|
||||
auto raw_data = DataGen(schema, N);
|
||||
|
||||
// load field data
|
||||
@ -2333,7 +2333,7 @@ TEST_P(ExprTest, TestRefactorExprs) {
|
||||
schema->set_primary_field_id(str1_fid);
|
||||
|
||||
auto seg = CreateSealedSegment(schema);
|
||||
int N = 1000000;
|
||||
int N = 10000;
|
||||
auto raw_data = DataGen(schema, N);
|
||||
|
||||
// load field data
|
||||
|
||||
@ -136,7 +136,7 @@ TEST_P(GrowingIndexTest, Correctness) {
|
||||
auto range_plan_str = range_query_plan_node.SerializeAsString();
|
||||
|
||||
int64_t per_batch = 10000;
|
||||
int64_t n_batch = 20;
|
||||
int64_t n_batch = 3;
|
||||
int64_t top_k = 5;
|
||||
for (int64_t i = 0; i < n_batch; i++) {
|
||||
auto dataset = DataGen(schema, per_batch);
|
||||
@ -247,8 +247,8 @@ TEST_P(GrowingIndexTest, GetVector) {
|
||||
|
||||
if (data_type == DataType::VECTOR_FLOAT) {
|
||||
// GetVector for VECTOR_FLOAT
|
||||
int64_t per_batch = 5000;
|
||||
int64_t n_batch = 20;
|
||||
int64_t per_batch = 10000;
|
||||
int64_t n_batch = 3;
|
||||
int64_t dim = 128;
|
||||
for (int64_t i = 0; i < n_batch; i++) {
|
||||
auto dataset = DataGen(schema, per_batch);
|
||||
@ -277,8 +277,8 @@ TEST_P(GrowingIndexTest, GetVector) {
|
||||
}
|
||||
} else if (is_sparse) {
|
||||
// GetVector for VECTOR_SPARSE_FLOAT
|
||||
int64_t per_batch = 5000;
|
||||
int64_t n_batch = 20;
|
||||
int64_t per_batch = 10000;
|
||||
int64_t n_batch = 3;
|
||||
int64_t dim = 128;
|
||||
for (int64_t i = 0; i < n_batch; i++) {
|
||||
auto dataset = DataGen(schema, per_batch);
|
||||
|
||||
@ -233,7 +233,7 @@ TEST(Indexing, BinaryBruteForce) {
|
||||
}
|
||||
|
||||
TEST(Indexing, Naive) {
|
||||
constexpr int N = 10000;
|
||||
constexpr int N = 1000;
|
||||
constexpr int TOPK = 10;
|
||||
|
||||
auto [raw_data, timestamps, uids] = generate_data<DIM>(N);
|
||||
@ -410,7 +410,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
std::pair(knowhere::IndexEnum::INDEX_HNSW, knowhere::metric::L2)));
|
||||
|
||||
TEST(Indexing, Iterator) {
|
||||
constexpr int N = 10240;
|
||||
constexpr int N = 1024;
|
||||
constexpr int TOPK = 100;
|
||||
constexpr int dim = 128;
|
||||
|
||||
@ -754,7 +754,7 @@ TEST(Indexing, SearchDiskAnnWithInvalidParam) {
|
||||
}
|
||||
|
||||
TEST(Indexing, SearchDiskAnnWithFloat16) {
|
||||
int64_t NB = 1000;
|
||||
int64_t NB = 100;
|
||||
int64_t NQ = 2;
|
||||
int64_t K = 4;
|
||||
IndexType index_type = knowhere::IndexEnum::INDEX_DISKANN;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user