[gs-bugs] [Bug 690352] GS 8.63 seems to consume more CPU compared to GS8.54

bugs.ghostscript.com-bugzilla-daemon at ghostscript.com bugs.ghostscript.com-bugzilla-daemon at ghostscript.com
Fri Jan 29 17:46:58 UTC 2010


http://bugs.ghostscript.com/show_bug.cgi?id=690352





------- Additional Comments From ray.johnston at artifex.com  2010-01-29 09:46 -------
Since the start-up time dominates, we performed profiling and tracing of
Ghostscript simply starting up and then quitting. This led to reducing the
number of different paths that were searched for the PostScript init files and
Resource files (including fonts) as well as turning off the IdiomRecognition
that slows down all ‘bind’ operations. Also, there are garbage collection
actions of the PostScript ‘VM” that are executed during the initialization and
start of jobs that are optional. Instead the ‘vmthreshold’ operator can be used
to allow garbage collection to only occur when it is required by the memory
allocation and ignore the ‘vmreclaim’ operator.

The changes were selected because these are readily applied to the 8.70 and 8.71
PRE-RELEASE versions (8.71 will be released in early February 2010) and thus do
not require a major effort for HP to apply to these and subsequent releases. The
methods to achieve these performance improvements are detailed below. All times
for our measurements are ‘real’ time seconds (also called wall clock times)
provided by the linux shell ‘time’ function. The ‘user’ time collected during
the runs correlates to the ‘real’ time reported by the shell.

The timings given by HP were:

	        ps->pdf	ps->pcl	ps->ps	pdf->ps
HP 8.54        	1423	1401	1433	1747
HP 8.63        	2748	1924	2677	2434
HP 8.63 / 8.54	93%	37%	87%	39%

For these particular versions, the timings for 50,000 jobs (files “input.ps” and
“input.pdf” from the bug 690352) on our server were:

	        ps->pdf	ps->pcl	ps->ps	pdf->ps
gs 8.54	        4480	4145	3815	5515
gs 8.63	        5885	5510	5370	6995
gs 8.63/gs 8.54	31%	33%	41%	27%

As mentioned above, the observed percentage performance degradation from 8.54 to
8.63 did not match those reported by HP for ps->pdf and ps->ps but were similar
for ps->pcl and pdf->ps.

The timings we observed for 8.53 vs. 8.70 (both “out of the box” builds from the
releases) were:

	                ps->pdf	ps->pcl	ps->ps	pdf->ps
gs 8.53	                4295	4170	3575	5315
gs 8.70	                6260	5615	4945	7010
8.70 original /8.53	46%	35%	38%	32%

After the optimization improvements to 8.70, and similar changes to 8.71
PRE-RELEASE the timings and relative performance are:

	                ps->pdf	ps->pcl	ps->ps	pdf->ps
gs 8.53	                4295	4170	3575	5315
Optimized gs 8.70	4020	3545	3425	5700
optimized 8.70 / 8.53	-6%	-15%	-4%	7%
				
Optimized gs 8.71	3775	3475	3105	5475
optimized 8.71 / 8.53	-12%	-17%	-13%	3%

The improvements were substantial and exceeded the goal specified in the SOW,
and the changes to the code base since 8.70 that are in the 8.71 PRE-RELEASE
provide even greater performance gains for the this usage of Ghostscript.

Detailed description of  the optimization.

1.	The ‘autogen.sh’ was used to generate a ‘Makefile’ for the system with the
parameters:
   ./autogen.sh --disable-contrib --disable-fontconfig –disable-cups

In particular, the ‘fontconfig’ was determined to be a major contributor to
the slowdown of releases. Support for fontconfig was added after the 8.53
release.

2.	The resulting ‘Makefile’ was modified to set:

SEARCH_HERE_FIRST=0
GS_LIB_DEFAULT=
COMPILE_INITS=0

Note that these changes could be performed as command line macros on the make
invocation, but it making the changes directly to the Makefile allowed for easy
tracking of the differences.

3.	The following command line options were added to the invocation of bin/gs:

-I.:Resource/Init –dNOGC -sGenericResourceDir=Resource/ -c "\
 << /IdiomRecognition false >> setuserparams" –f
	
The ‘\’ in the above line is not needed but is shown for to indicate that the line
	is to be joined.
	
Since the GS_LIB_DEFAULT paths were eliminated by the changes that were made in
(2), explicit search paths are established by the -I.:Resource/Init and the
Resource file locations are specified by -sGenericResourceDir=Resource/

IdiomRecognition is disabled using the setuserparams operator so that the extra
processing of the bind operator can be avoided.

Testing Details (scripts).

The scripts make use of ‘shell arithmetic’ to increment the ‘x’ count variable.
Timings of the loop structure, without the bin/gs invocation within the loop
were performed to confirm that the shell loop overhead was less than 1%. 

The script used to perform the timing on the 8.53 release, built with the
default build settings (which did not include COMPILE_INITS=1) was:


echo Revision: 8.53 >> time.log
COUNT=50000
O=time.log

date >> time.log
echo "================= PS to PDF ==========================" >> time.log
time ( x=1; while [ $x -lt $COUNT ] ; do
      bin/gs -I../fonts -q  -sDEVICE=pdfwrite -sOutputFile=x.pdf -dBATCH
-dNOPAUSE ../bugs/dazel/Bug_690352_input.ps >> $O 2>&1
      x=$(( $x + 1 ))
done ) >> time.log 2>&1

date >> time.log
echo "================= PS to PCL (ljet4) ===================" >> time.log
time ( x=1; while [ $x -lt $COUNT ] ; do
      bin/gs -I../fonts -q  -sDEVICE=ljet4 -sOutputFile=x.pcl -dBATCH -dNOPAUSE
../bugs/dazel/Bug_690352_input.ps >> $O 2>&1
      x=$(( $x + 1 ))
done ) >> time.log 2>&1

date >> time.log
echo "================= PS to PS (pswrite) ==================" >> time.log
time ( x=1; while [ $x -lt $COUNT ] ; do
      bin/gs -I../fonts -q  -sDEVICE=pswrite -sOutputFile=x.ps -dBATCH -dNOPAUSE
 ../bugs/dazel/Bug_690352_input.ps >> $O 2>&1
      x=$(( $x + 1 ))
done ) >> time.log 2>&1

date >> time.log
echo "================= PDF to PS (pswrite) =================" >> time.log
time ( x=1; while [ $x -lt $COUNT ] ; do
      bin/gs -I../fonts -q  -sDEVICE=pswrite -sOutputFile=x.ps -dBATCH -dNOPAUSE
 ../bugs/dazel/Bug_690352_input.pdf >> $O 2>&1
      x=$(( $x + 1 ))
done ) >> time.log 2>&1
date >> time.log

The script used for 8.70 and 8.71 test (which show the additional command line
options was:

echo Revision: 8.70 optimized > time.log
COUNT=50000
O=time.log

date >> time.log
echo "================= PS to PDF ==========================" >> time.log
time ( x=1; while [ $x -lt $COUNT ] ; do
      bin/gs -sGenericResourceDir=Resource/ -q -I.:Resource/Init
-sDEVICE=pdfwrite -sOutputFile=x.pdf -dBATCH -dNOPAUSE -dNOGC -c "<<
/IdiomRecognition false >> setuserparams" -f ../bugs/dazel/Bug_690352_input.ps
>> $O 2>&1
      x=$(( $x + 1 ))
done ) >> time.log 2>&1

date >> time.log
echo "================= PS to PCL (ljet4) ===================" >> time.log
time ( x=1; while [ $x -lt $COUNT ] ; do
      bin/gs -sGenericResourceDir=Resource/ -q -I.:Resource/Init -sDEVICE=ljet4
-sOutputFile=x.pcl -dBATCH -dNOPAUSE -dNOGC -c "<< /IdiomRecognition false >>
setuserparams" -f ../bugs/dazel/Bug_690352_input.ps >> $O 2>&1
      x=$(( $x + 1 ))
done ) >> time.log 2>&1

date >> time.log
echo "================= PS to PS (pswrite) ==================" >> time.log
time ( x=1; while [ $x -lt $COUNT ] ; do
      bin/gs -sGenericResourceDir=Resource/ -q -I.:Resource/Init
-sDEVICE=pswrite -sOutputFile=x.ps -dBATCH -dNOPAUSE -dNOGC -c "<<
/IdiomRecognition false >> setuserparams" -f ../bugs/dazel/Bug_690352_input.ps
>> $O 2>&1
      x=$(( $x + 1 ))
done ) >> time.log 2>&1

date >> time.log
echo "================= PDF to PS (pswrite) =================" >> time.log
time ( x=1; while [ $x -lt $COUNT ] ; do
      bin/gs -sGenericResourceDir=Resource/ -q -I.:Resource/Init
-sDEVICE=pswrite -sOutputFile=x.ps -dBATCH -dNOPAUSE -dNOGC -c "<<
/IdiomRecognition false >> setuserparams" -f ../bugs/dazel/Bug_690352_input.pdf
>> $O 2>&1
      x=$(( $x + 1 ))
done ) >> time.log 2>&1
date >> time.log




------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


More information about the gs-bugs mailing list