* A yang type regex cache added, this helps the performance by avoiding re-running the regcomp command on every iteration.
* An XML namespace cache added (see `xml2ns()`) * Better performance of XML whitespace parsing/scanning.
This commit is contained in:
parent
728c97ab6d
commit
8c36083e16
8 changed files with 214 additions and 19 deletions
|
|
@ -69,6 +69,7 @@
|
|||
#include <sys/param.h>
|
||||
#include <netinet/in.h>
|
||||
#include <libgen.h>
|
||||
#include <regex.h>
|
||||
|
||||
/* cligen */
|
||||
#include <cligen/cligen.h>
|
||||
|
|
@ -222,6 +223,20 @@ yang_cvec_get(yang_stmt *ys)
|
|||
return ys->ys_cvec;
|
||||
}
|
||||
|
||||
void*
|
||||
yang_regex_cache_get(yang_stmt *ys)
|
||||
{
|
||||
return ys->ys_regex_cache;
|
||||
}
|
||||
|
||||
int
|
||||
yang_regex_cache_set(yang_stmt *ys,
|
||||
void *regex)
|
||||
{
|
||||
ys->ys_regex_cache = regex;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* End access functions */
|
||||
|
||||
/*! Create new yang specification
|
||||
|
|
@ -266,6 +281,17 @@ ys_new(enum rfc_6020 keyw)
|
|||
return ys;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
yang_regex_cache_free(yang_stmt *ys)
|
||||
{
|
||||
if (ys->ys_regex_cache){
|
||||
regfree(ys->ys_regex_cache);
|
||||
free(ys->ys_regex_cache);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! Free a single yang statement */
|
||||
static int
|
||||
ys_free1(yang_stmt *ys)
|
||||
|
|
@ -280,6 +306,7 @@ ys_free1(yang_stmt *ys)
|
|||
cvec_free(ys->ys_cvec);
|
||||
if (ys->ys_typecache)
|
||||
yang_type_cache_free(ys->ys_typecache);
|
||||
yang_regex_cache_free(ys);
|
||||
free(ys);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue