Skip to content

Commit ff4b5c5

Browse files
committed
do not use recursion in Cover() - ~2% performance
1 parent 3283aed commit ff4b5c5

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

rum_ts_utils.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -656,15 +656,13 @@ Cover(DocRepresentation *doc, uint32 len, QueryRepresentation *qr,
656656
Extention *ext)
657657
{
658658
DocRepresentation *ptr;
659-
int lastpos = ext->pos;
659+
int lastpos;
660660
int i;
661-
bool found = false;
661+
bool found;
662662

663-
/*
664-
* since this function recurses, it could be driven to stack overflow.
665-
* (though any decent compiler will optimize away the tail-recursion.
666-
*/
667-
check_stack_depth();
663+
restart:
664+
lastpos = ext->pos;
665+
found = false;
668666

669667
memset(qr->operandexist, 0, sizeof(bool) * qr->lenght);
670668

@@ -742,7 +740,7 @@ Cover(DocRepresentation *doc, uint32 len, QueryRepresentation *qr,
742740
}
743741

744742
ext->pos++;
745-
return Cover(doc, len, qr, ext);
743+
goto restart;
746744
}
747745

748746
static DocRepresentation *

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy