mirror of https://github.com/arendst/Tasmota.git
Merge pull request #13011 from s-hadinger/berry_constants_search_size
Berry constant search size
This commit is contained in:
commit
db33fbda21
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue