Merge pull request #13011 from s-hadinger/berry_constants_search_size

Berry constant search size
This commit is contained in:
s-hadinger 2021-08-30 19:25:00 +02:00 committed by GitHub
commit db33fbda21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -85,6 +85,16 @@
**/
#define BE_STACK_FREE_MIN 20
/* Macro: BE_CONST_SEARCH_SIZE
* Constants in function are limited to 255. However the compiler
* will look for a maximum of pre-existing constants to avoid
* performance degradation. This may cause the number of constants
* to be higher than required.
* Increase is you need to solidify functions.
* Default: 50
**/
#define BE_CONST_SEARCH_SIZE 150
/* Macro: BE_STACK_FREE_MIN
* The short string will hold the hash value when the value is
* true. It may be faster but requires more RAM.

View File

@ -251,7 +251,7 @@ static int newconst(bfuncinfo *finfo, bvalue *k)
}
/* Find constant by value and return constant number, or -1 if constant does not exist */
/* The search is linear and limited to 100 elements for performance reasons */
/* The search is linear and limited to BE_CONST_SEARCH_SIZE elements for performance reasons */
static int findconst(bfuncinfo *finfo, bexpdesc *e)
{
int i, count = be_vector_count(&finfo->kvec);
@ -260,7 +260,7 @@ static int findconst(bfuncinfo *finfo, bexpdesc *e)
* so only search the constant table for the
* previous value.
**/
count = count < 100 ? count : 100;
count = count < BE_CONST_SEARCH_SIZE ? count : BE_CONST_SEARCH_SIZE;
for (i = 0; i < count; ++i) {
bvalue *k = be_vector_at(&finfo->kvec, i);
switch (e->type) {