Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4caa336

Browse files
committed
5% improvements by eliminationg visited array in rum_reconstruct_tsvector()
1 parent48aae44 commit4caa336

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

‎rum_ts_utils.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -540,14 +540,12 @@ rum_reconstruct_tsvector(bool *check, TSQuery query, int *map_item_operand,
540540
int32wordlen;
541541
}*restoredWordEntry;
542542
intlen=0,totallen;
543-
bool*visited;
544543
WordEntry*ptr;
545544
char*str;
546545
intstroff;
547546

548547

549548
restoredWordEntry=palloc(sizeof(*restoredWordEntry)*query->size);
550-
visited=palloc0(sizeof(*visited)*query->size);
551549

552550
/*
553551
* go through query to collect lexemes and add to them
@@ -560,13 +558,13 @@ rum_reconstruct_tsvector(bool *check, TSQuery query, int *map_item_operand,
560558
{
561559
intkeyN=map_item_operand[i];
562560

563-
if (check[keyN]== true&&visited[keyN]== false)
561+
if (check[keyN]== true)
564562
{
565563
/*
566564
* entries could be repeated in tsquery, do not visit them twice
567-
* or more
565+
* or more. Modifying of check array (entryRes) is safe
568566
*/
569-
visited[keyN]=true;
567+
check[keyN]=false;
570568

571569
restoredWordEntry[cntwords].word=operandData+item->qoperand.distance;
572570
restoredWordEntry[cntwords].wordlen=item->qoperand.length;
@@ -640,7 +638,6 @@ rum_reconstruct_tsvector(bool *check, TSQuery query, int *map_item_operand,
640638
}
641639

642640
pfree(restoredWordEntry);
643-
pfree(visited);
644641

645642
returntsv;
646643
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp