[GRASS-dev] slow $PROMPT_COMMAND

Glynn Clements glynn at gclements.plus.com
Fri Sep 26 08:34:54 EDT 2008


Hamish wrote:

> I have noticed in the last week(s) in grass 6.4svn -text mode that there
> is some ~250ms delay at the GRASS terminal when I hit <enter>. Restarting
> in GRASS 6.3.0 the response is instant, as is the normal linux terminal
> prompt.
> 
> The CPU monitor jumps to 100% for an instant, holding down <enter> stalls
> the terminal after 10-15 lines or so as the CPU is pegged at 100%.
> 
> `top` tells me that g.gisenv is to blame.
> 
> PS1="G64svn:\W > "      # (set by .grass.bashrc)
> PS2="> "
> PS4="+ "
> 
> lib/init/prompt.sh  (given by $PROMPT_COMMAND) hasn't changed in 2 years.
> I don't see any highly suspicious changes to g.gisenv/main.c.
> Was it some change in libgis then?
> 
> "unset PROMPT_COMMAND" fixes it of course.
> 
> 
> what gives?

Try --without-gdal.

Here:

	# 7.0, with GDAL
	$ time for (( i = 0; $i < 1000 ; i=i+1 )) ; do g.gisenv MAPSET ; done >/dev/null
	
	real	0m6.891s
	user	0m4.893s
	sys	0m2.083s
	
	# 7.0, without GDAL
	$ time for (( i = 0; $i < 1000 ; i=i+1 )) ; do g.gisenv MAPSET ; done >/dev/null
	
	real	0m1.260s
	user	0m0.390s
	sys	0m0.703s

GDAL is written in C++. Any statically-allocated objects have their
constructors run when the library is loaded, and their destructors run
when it is unloaded, even if no library functions are ever called.

GDAL also links against a number of other libraries, possibly a large
number of them, some of which may have similar issues.

Hmm. We might want to allow the r.external support (i.e. linking
libgis against GDAL) to be enabled/disabled separately from the use of
GDAL by lib/proj and r.{in,out}.gdal.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list