diff options
| author | Heiko Schocher <hs@denx.de> | 2013-12-19 13:45:04 +0100 | 
|---|---|---|
| committer | Tom Rini <trini@ti.com> | 2014-01-14 09:01:06 -0500 | 
| commit | 1b6102718bc5514cf974abeecebebe95c6a9ecc6 (patch) | |
| tree | 2ebd35092871e6f5dce93498d9ad8e0899848aa3 /common/env_callback.c | |
| parent | a113fb39df43546c704aa8eba55720da9a9dfedd (diff) | |
| download | olio-uboot-2014.01-1b6102718bc5514cf974abeecebebe95c6a9ecc6.tar.xz olio-uboot-2014.01-1b6102718bc5514cf974abeecebebe95c6a9ecc6.zip | |
common, env: optimize boottime
when creating the hashtable, for each environmentvariable
getenv(ENV_CALLBACK_VAR) and getenv(ENV_FLAGS_VAR) is called,
which costs at this point a lot of time. So call this two
getenv() calls only once.
Boottime on the ids8313 board without this patch:
2013-12-19 13:38:22,894:  NAND:  128 MiB
2013-12-19 13:38:27,659:  In:    serial
(~4.8 sec)
Bootime with this patch on the ids8313 board:
2013-12-19 13:40:25,332:  NAND:  128 MiB
2013-12-19 13:40:25,546:  In:    serial
(~0.2 sec)
Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'common/env_callback.c')
| -rw-r--r-- | common/env_callback.c | 9 | 
1 files changed, 8 insertions, 1 deletions
| diff --git a/common/env_callback.c b/common/env_callback.c index 34bb58e4a..d03fa03a4 100644 --- a/common/env_callback.c +++ b/common/env_callback.c @@ -35,6 +35,9 @@ static struct env_clbk_tbl *find_env_callback(const char *name)  	return NULL;  } +static int first_call = 1; +static const char *callback_list; +  /*   * Look for a possible callback for a newly added variable   * This is called specifically when the variable did not exist in the hash @@ -43,11 +46,15 @@ static struct env_clbk_tbl *find_env_callback(const char *name)  void env_callback_init(ENTRY *var_entry)  {  	const char *var_name = var_entry->key; -	const char *callback_list = getenv(ENV_CALLBACK_VAR);  	char callback_name[256] = "";  	struct env_clbk_tbl *clbkp;  	int ret = 1; +	if (first_call) { +		callback_list = getenv(ENV_CALLBACK_VAR); +		first_call = 0; +	} +  	/* look in the ".callbacks" var for a reference to this variable */  	if (callback_list != NULL)  		ret = env_attr_lookup(callback_list, var_name, callback_name); |