diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex | 74 |
1 files changed, 67 insertions, 7 deletions
diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex index d915a4f8a1a..194e82d6aa4 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex @@ -1,8 +1,9 @@ \section{Memory and Speed considerations} +\subsection{Memory Limits of \TeX} \label{sec:pgfplots:optimization} \PGFPlots\ can typeset plots with several thousand points if memory limits of \TeX\ are configured properly. Its runtime is roughly proportional to the number of input points\footnote{In fact, the runtime is pseudo--linear: starting with about $100{,}000$ points, it will become quadratic. This limitation applies to the path length of \PGF\ paths as well. Furthermore, the linear runtime is not possible yet for stacked plots.}. -\message{ATTENTION: I am now about to typeset really huge pictures. You will need to ENLARGE YOUR TeX MEMORY CAPACITIES if this fails...}% +\pgfplotsexpensiveexample \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[ @@ -19,6 +20,7 @@ \end{tikzpicture} \end{codeexample} +\pgfplotsexpensiveexample \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[ @@ -26,27 +28,47 @@ title=Ornstein-Uhlenbeck sample ($13000$ time steps), xlabel=$t$] -\addplot[blue] file{plotdata/ou.dat}; + +\addplot[blue] file {plotdata/ou.dat}; \end{axis} \end{tikzpicture} \end{codeexample} -\message{ok, passed.}% \PGFPlots\ relies completely on \TeX\ to do all typesetting. It uses the front-end-layer and basic layer of \PGF\ to perform all drawing operations. For complicated plots, this may take some time, and you may want to read section~\ref{sec:pgfplots:importexport} for how to write single figures to external graphics files. Externalization is the best way to reduce typesetting time. However, for large scale plots with a lot of points, limitations of \TeX's capacities are reached easily. -\subsection{Memory limitations} -The default settings of most \TeX-distributions are quite restrictive, so it may be necessary to adjust them. For Mik\TeX, this can be done using simple command line switches: +\subsection{Memory Limitations} +The default settings of most \TeX-distributions are quite restrictive, so it may be necessary to adjust them. + +Usually, the log--file or the final error message contains a summary about the used ressources, giving a hint which parameter needs to be increased. + +\subsubsection{Mik\TeX} +For Mik\TeX, memory limits can be increased in two ways. The first is to use command line switches: \begin{codeexample}[code only] pdflatex --stack-size=n --save-size=n --main-memory=n --extra-mem-top=n --extra-mem-bot=n --pool-size=n --max-strings=n \end{codeexample} -\noindent Experiment with these settings if Mik\TeX\ runs out of memory. +\noindent Experiment with these settings if Mik\TeX\ runs out of memory. Usually, one doesn't invoke |pdflatex| manually: there is a development aid which does all the invocations, so this one needs to be adjusted. + +Sometimes it might be better to adjust the Mik\TeX\ configuration file permanently, for example to avoid reconfiguring the \TeX\ development program. This can be realized using the command +\begin{codeexample}[code only] +initexmf --edit-config-file=pdflatex +\end{codeexample} +\noindent which can be typed either on a command prompt in Windows or using Start $\gg$ Execute. As a result, an editor will be opened with the correct config file. A sample config file could be +\begin{codeexample}[code only] +main_memory=90000000 +save_size=80000 +\end{codeexample} +or any of the config file entries which are listed below can be entered. +Thanks to ``LeSpocky'' for his documentation in -Usually, the log--file contains a summary about the used ressources, giving a hint which parameter needs to be increased. For Unix installations, one needs to adjust config files. This can be done as follows: +\url{http://blog.antiblau.de/2009/04/21/speicherlimits-von-miktex-erhoehen}. + +\subsubsection{\TeX Live or similar installations} +For Unix installations, one needs to adjust config files. This can be done as follows: \begin{enumerate} \item Locate |texmf.cnf| on your system. On my Ubuntu installation, it is in @@ -72,4 +94,42 @@ stack_size = n \end{codeexample} The log--file usually contains information about the parameter which needs to be enlarged. \end{enumerate} +An example of this config file thing is shown below. It changes memory limits. +\begin{enumerate} + \item Create the file |~/texmf/mytexcnf/texmf.cnf| (and possibly the paths as well). +\begin{codeexample}[code only] +% newly created file ~/texmf/mytexcnf/texmf.cnf: +% If you want to change some of these sizes only for a certain TeX +% variant, the usual dot notation works, e.g., +% main_memory.hugetex = 20000000 +main_memory = 230000000 % words of inimemory available; also applies to inimf&mp +extra_mem_top = 10000000 % extra high memory for chars, tokens, etc. +extra_mem_bot = 10000000 % extra low memory for boxes, glue, breakpoints, etc. +save_size = 150000 % for saving values outside current group +stack_size = 150000 % simultaneous input sources + +% Max number of characters in all strings, including all error messages, +% help texts, font names, control sequences. These values apply to TeX and MP. +%pool_size = 1250000 +% Minimum pool space after TeX/MP's own strings; must be at least +% 25000 less than pool_size, but doesn't need to be nearly that large. +%string_vacancies = 90000 +% Maximum number of strings. +%max_strings = 100000 +% min pool space left after loading .fmt +%pool_free = 47500 +\end{codeexample} + \item Run |texhash| such that \TeX\ updates its |~/texmf/ls-R| database. + \item Create the environment variable |TEXMFCNF| and assign the value `|~/texmf/mytexcnf:|' (including the trailing `|:|'!). For my linux system, this can be done using by adding +\begin{codeexample}[code only] +export TEXMFCNF=~/texmf/mytexcnf: +\end{codeexample} + to |~/.bashrc|. +\end{enumerate} + Unfortunately, \TeX\ does not allow arbitrary memory limits, there is an upper bound hard coded in the executables. + +\subsection{Reducing Typesetting Time} +\PGFPlots\ does a lot of computations ranging from abstract coordinate computations to low level |.pdf| drawing commands (realized by \PGF). For complex plots, this may take a considerable time -- especially for 3D plots. + +One possibility to reduce typesetting time is to tell \PGF\ to generate single, temporary |.pdf| (or |.eps|) documents for a subset (or all) graphics in one run and re-use these temporary images in successive runs. For \PGFPlots, this is the most effective way to reduce typesetting time. It can be accomplished using the |external| library described in section~\ref{sec:pgfplots:export}. |