[OPTIMIZE]delete update_hit_groups to reduce cpu consumption & reduce maat_state memory usage
This commit is contained in:
@@ -58,7 +58,6 @@ enum match_method {
|
||||
struct expr_item {
|
||||
long long item_id;
|
||||
long long group_id;
|
||||
long long district_id;
|
||||
char keywords[MAX_KEYWORDS_STR];
|
||||
enum expr_type expr_type;
|
||||
enum hs_match_mode match_mode;
|
||||
@@ -66,6 +65,7 @@ struct expr_item {
|
||||
int is_case_sensitive;
|
||||
void *user_data;
|
||||
void (*user_data_free)(void *data);
|
||||
int district_id;
|
||||
};
|
||||
|
||||
struct expr_runtime {
|
||||
@@ -140,7 +140,7 @@ enum hs_match_mode int_to_match_mode(int match_method)
|
||||
return mode;
|
||||
}
|
||||
|
||||
long long expr_runtime_get_district_id(struct expr_runtime *expr_rt, const char *district)
|
||||
int expr_runtime_get_district_id(struct expr_runtime *expr_rt, const char *district)
|
||||
{
|
||||
long long district_id = DISTRICT_ANY;
|
||||
|
||||
@@ -158,7 +158,7 @@ long long expr_runtime_get_district_id(struct expr_runtime *expr_rt, const char
|
||||
}
|
||||
}
|
||||
|
||||
return district_id;
|
||||
return (int)district_id;
|
||||
}
|
||||
|
||||
int expr_runtime_set_scan_district(struct expr_runtime *expr_rt, const char *district,
|
||||
@@ -979,11 +979,11 @@ int expr_runtime_scan(struct expr_runtime *expr_rt, int thread_id,
|
||||
struct item_district *item_dist = NULL;
|
||||
struct expr_item *expr_item = NULL;
|
||||
size_t real_hit_item_cnt = 0;
|
||||
long long district_id = state->district_id;
|
||||
int district_id = state->district_id;
|
||||
|
||||
for (size_t i = 0; i < n_hit_item; i++) {
|
||||
item_dist = (struct item_district *)(hit_results[i].user_tag);
|
||||
long long tag_district_id = item_district_id(item_dist);
|
||||
int tag_district_id = item_district_id(item_dist);
|
||||
if (tag_district_id == district_id || tag_district_id == DISTRICT_ANY) {
|
||||
long long item_id = hit_results[i].rule_id;
|
||||
expr_item = (struct expr_item *)rcu_hash_find(expr_rt->item_hash,
|
||||
|
||||
Reference in New Issue
Block a user