[Tikzdevice-bugs] Peformance

Cameron Bracken cameron.bracken at gmail.com
Fri Dec 4 20:50:47 CET 2009


That problem is from the XeLaTeX test, which has been segfaulting for
a while, I don't know why. Apologies for the lack of instructions.
The rest of the tests should work if you comment out the line

source('testXeLaTeX.R')

near the top of testRTikZDevice.R. Then you can either run the script
run-tests.sh (which builds and installs the package) or do what you
did before (it is better to redirect the output to another directory)

mkdir output
Rscript testRTikZDevice.R --output-prefix=output

If you want to investigate the speedup from global string width
caching put a line like

options(tikzMetricsDictionary = "/Users/cameron/.tikzMetricsDictionary")

In your .Rprofile file. The first run will be slow then subsequent
runs will be much faster. For example on my system without using
global string width caching:

  Running Test 01 ... Done, took  4.455 seconds.
Compiling Test 01 ... Done, took  0.423 seconds.
  Running Test 02 ... Done, took  1.145 seconds.
Compiling Test 02 ... Done, took  0.419 seconds.
  Running Test 03 ... Done, took  6.042 seconds.
Compiling Test 03 ... Done, took  0.542 seconds.
  Running Test 04 ... Done, took  6.719 seconds.
Compiling Test 04 ... Done, took  0.586 seconds.
  Running Test 05 ... Done, took  11.283 seconds.
Compiling Test 05 ... Done, took  0.676 seconds.
  Running Test 06 ... Done, took  0.391 seconds.
Compiling Test 06 ... Done, took  0.449 seconds.
  Running Test 07 ... Done, took  0.365 seconds.
Compiling Test 07 ... Done, took  0.423 seconds.
  Running Test 08 ... Done, took  0.355 seconds.
Compiling Test 08 ... Done, took  0.405 seconds.
  Running Test 09 ... Done, took  0.394 seconds.
Compiling Test 09 ... Done, took  0.399 seconds.
  Running Test 10 ... Done, took  0.364 seconds.
Compiling Test 10 ... Done, took  0.411 seconds.
  Running Test 11 ... Done, took  0.364 seconds.
Compiling Test 11 ... Done, took  0.422 seconds.
  Running Test 12 ... Done, took  0.376 seconds.
Compiling Test 12 ... Done, took  0.401 seconds.
  Running Test 13 ... Done, took  0.376 seconds.
Compiling Test 13 ... Done, took  0.568 seconds.
  Running Test 14 ... Done, took  0.381 seconds.
Compiling Test 14 ... Done, took  1.995 seconds.
  Running Test 15 ... Done, took  23.414 seconds.
Compiling Test 15 ... Done, took  3.241 seconds.
  Running Test 16 ... Done, took  27.007 seconds.
Compiling Test 16 ... Done, took  0.779 seconds.
  Running Test 17 ... Done, took  2.648 seconds.
Compiling Test 17 ... Done, took  0.415 seconds.
  Running Test 18 ... Done, took  2.183 seconds.
Compiling Test 18 ... Done, took  3.592 seconds.
  Running Test 19 ... Done, took  17.97 seconds.
Compiling Test 19 ... Done, took  2.409 seconds.

and with caching

  Running Test 01 ... Done, took  0.085 seconds.
Compiling Test 01 ... Done, took  0.428 seconds.
  Running Test 02 ... Done, took  0.031 seconds.
Compiling Test 02 ... Done, took  0.439 seconds.
  Running Test 03 ... Done, took  0.198 seconds.
Compiling Test 03 ... Done, took  0.529 seconds.
  Running Test 04 ... Done, took  0.254 seconds.
Compiling Test 04 ... Done, took  0.556 seconds.
  Running Test 05 ... Done, took  0.353 seconds.
Compiling Test 05 ... Done, took  0.66 seconds.
  Running Test 06 ... Done, took  0.021 seconds.
Compiling Test 06 ... Done, took  0.45 seconds.
  Running Test 07 ... Done, took  0.013 seconds.
Compiling Test 07 ... Done, took  0.426 seconds.
  Running Test 08 ... Done, took  0.014 seconds.
Compiling Test 08 ... Done, took  0.393 seconds.
  Running Test 09 ... Done, took  0.012 seconds.
Compiling Test 09 ... Done, took  0.403 seconds.
  Running Test 10 ... Done, took  0.028 seconds.
Compiling Test 10 ... Done, took  0.463 seconds.
  Running Test 11 ... Done, took  0.015 seconds.
Compiling Test 11 ... Done, took  0.415 seconds.
  Running Test 12 ... Done, took  0.021 seconds.
Compiling Test 12 ... Done, took  0.408 seconds.
  Running Test 13 ... Done, took  0.014 seconds.
Compiling Test 13 ... Done, took  0.544 seconds.
  Running Test 14 ... Done, took  0.022 seconds.
Compiling Test 14 ... Done, took  1.86 seconds.
  Running Test 15 ... Done, took  1.484 seconds.
Compiling Test 15 ... Done, took  3.33 seconds.
  Running Test 16 ... Done, took  2.988 seconds.
Compiling Test 16 ... Done, took  0.779 seconds.
  Running Test 17 ... Done, took  0.111 seconds.
Compiling Test 17 ... Done, took  0.437 seconds.
  Running Test 18 ... Done, took  0.096 seconds.
Compiling Test 18 ... Done, took  3.585 seconds.
  Running Test 19 ... Done, took  11.742 seconds.
Compiling Test 19 ... Done, took  2.293 seconds.

The last thing you can do if you really want to get into it is turn on
the debugging switch in tikzDevice.c by changing the line

#define DEBUG FALSE

near the top of the file to

#define DEBUG TRUE

Then recompiling and installing the package. After this running the
test will show the number of times string width was calculated or
looked up which will give you some idea of where the speedup is coming
from.

-Cameron



On Fri, Dec 4, 2009 at 5:12 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
>
> Thanks.  When I try to run the test it fails.  This is the stderr output is shown below and test.log is attached.  I am on Windows Vista and am running R 2.10.0.
>
> ---
>
> C:\tmp2\tikzDevice\inst\tests>Rscript testRTikZDevice.R --output=output > test.l
> og
> Loading required package: filehash
> Loading required package: methods
> filehash: Simple key-value database (2.0-1 2008-12-19)
> tikzDevice: A Device for R Graphics Output in PGF/TikZ Format (v0.4.8)
> Checking for a LaTeX compiler...
>
>
> A working LaTeX compiler was found in:
>         The PATH using the command latex
>
> Global option tikzLatex set to:
>         C:\PROGRA~1\MIKTEX~1.7\miktex\bin\latex.exe
>
> MiKTeX-pdfTeX 2.7.2808 (1.40.4) (MiKTeX 2.7)
> Copyright (C) 1982 D. E. Knuth, (C) 1996-2006 Han The Thanh
> TeX is a trademark of the American Mathematical Society.
>
>
> Error in getMetricsFromLatex(TeXMetrics) :
>   ******** There was a problem calculating string metrics,
>   ******** likely there was a problem with your custom packages.
>   ******** See the LaTeX log file above for details.
> Calls: source ... Axis.default -> axis -> <Anonymous> -> getMetricsFromLatex
> Execution halted
>
> ---
>
> On Wed, Dec 2, 2009 at 8:23 PM, Cameron Bracken <cameron.bracken at gmail.com> wrote:
>>
>> Not quite sure what you mean by relative speed, but yes there is a test suite that times some output.  The suite is in the inst/tests directory of the source code. A vast majority of the time is taken by calculating string widths.  The performance gain from caching metrics calculations is very noticable, somtimes up to 90% when lots of strings are involved. Does this answer your question?
>>
>> -Cameron
>>
>> On Dec 2, 2009, at 6:10 PM, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
>>
>>> Are there any performance benchmarks for tikzdevice?  Is the relative speed noticeable?
>>>
>>>
>>> _______________________________________________
>>> Tikzdevice-bugs mailing list
>>> Tikzdevice-bugs at lists.r-forge.r-project.org
>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/tikzdevice-bugs
>


More information about the Tikzdevice-bugs mailing list