[U-Boot] [PATCH 0/5] New environment code

Wolfgang Denk wd at denx.de
Sat Jul 17 23:55:36 CEST 2010


In message <1279395948-25864-1-git-send-email-wd at denx.de> I wrote:
>
> The following patch series adds some utilities (qsort and hash table
> based database functions) and uses these to reimplement the code used
> for the internal handling of environment variables.
> 
> 
> Motivation:
> 
> * Old environment code used a pessimizing implementation:
>   - variable lookup used linear search => slow
>   - changed/added variables were added at the end, i. e. most
>     frequently used variables had the slowest access times => slow
>   - each setenv() would calculate the CRC32 checksum over the whole
>     environment block => slow

Just to give a datapoint for speed:

measured on TQM5200 (MPC5200 at 400 MHz, environment size 16 kB):

OLD implementation:

	=> sete ttt 'date;for i in 0 1 2 3 4 5 6 7 8 9 ; do for j in 0 1 2 3 4 5 6 7 8 9 ; do for k in 0 1 2 3 4 5 6 7 8 9 ; do run tt ; done ; done ; done;date'
	=> sete tt 'sete var1 xxx;sete var2 ${var1};sete var1 ${var2};sete var1;sete var2'
	=> run tt
	=> run ttt
	Date: 1910-07-17 (unknown day)    Time: 22:02:31
	Date: 1910-07-17 (unknown day)    Time: 22:03:27

New implementation:

	=> run ttt
	Date: 1910-07-17 (unknown day)    Time: 20:45:51
	Date: 1910-07-17 (unknown day)    Time: 20:45:53



I. e. we have 56 versus 2 seconds.

I haven't run intensive tests, but in general I think we can see that
scripts referncing environment variables will typically run faster by
a factor of 10, or more.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Time is an illusion perpetrated by the manufacturers of space.


More information about the U-Boot mailing list