29
$\begingroup$

Based on this question: - Version 7 print environment - I set up two 10 page test documents in version 7.0.1 and version 10.1. The version 7 document exported to PDF in 4.18 seconds whereas the version 10 export took 424.6 seconds.

Can I speed up export from version 10?

These are the test exports.

For Version 7

time = DateList[];
SetOptions[$FrontEndSession,
  PrintingOptions -> {"PrintingMargins" -> {{45, 43}, {17, 31}},
    "FirstPageHeader" -> False, "FirstPageFooter" -> False,
    "RestPagesHeader" -> False, "RestPagesFooter" -> False,
    "Magnification" -> 1}];
text = StringReplace[StringTake[
    ExampleData[{"Text", "Prufrock"}], 4221],
   FromCharacterCode[{195, 162, 128, 194, 153}] -> "'"];
square = Graphics[{Orange, Rectangle[{0, 0}, {70, 70}]},
   PlotRange -> {{0, 70}, {0, 70}}];
column = Table[Inset[square, {415, 100 i}, {Left, Bottom},
    {70, 70}], {i, 0, 9}];
page = Graphics[{White, Rectangle[{0, 0}, {500, 973}], Black,
    Inset[TextCell[text, LineSpacing -> {0, 16},
      TextJustification -> 1], {0, 973}, {Left, Top}, {400, 973}],
    column}, PlotRange -> {{0, 500}, {0, 973}}, ImageSize -> 500, 
   BaseStyle -> {FontFamily -> "Times", FontWeight -> "Plain", FontSize -> 14}];
nb = CreateDocument[ConstantArray[ExpressionCell[page, "Print"], 10],
   WindowSize -> 800];
filename = StringJoin["v", ToString[Round@$VersionNumber], ".pdf"];
Quiet@DeleteFile[filename];
Export[filename, nb];
NotebookClose[nb];
DateDifference[time, DateList[], "Second"]

{4.18004, Second}

For Version 10

time = DateList[];
SetOptions[$FrontEndSession,
  PrintingOptions -> {"PrintingMargins" -> {{11, 43}, {15, 31}},
    "FirstPageHeader" -> False, "FirstPageFooter" -> False,
    "RestPagesHeader" -> False, "RestPagesFooter" -> False,
    "Magnification" -> 1}];
text = StringReplace[StringTake[
    ExampleData[{"Text", "Prufrock"}], 4221],
   FromCharacterCode[{195, 162, 128, 194, 153}] -> "'"];
square = Graphics[{Orange, Rectangle[{0, 0}, {70, 70}]},
   PlotRange -> {{0, 70}, {0, 70}}];
column = Table[Inset[square, {415, 100 i}, {Left, Bottom},
    {70, 70}], {i, 0, 9}];
page = Graphics[{White, Rectangle[{0, 0}, {500, 973}], Black,
    Inset[TextCell[text, LineSpacing -> {0, 17},
      TextJustification -> 1], {0, 973}, {Left, Top}, {400, 973}],
    column}, PlotRange -> {{0, 500}, {0, 973}}, ImageSize -> 555,
   BaseStyle -> {FontFamily -> "Times", FontWeight -> "Plain", FontSize -> 15.5}];
nb = CreateDocument[ConstantArray[ExpressionCell[page, "Print"], 10],
   WindowSize -> 800];
filename = StringJoin["v", ToString[Round@$VersionNumber], ".pdf"];
Quiet@DeleteFile[filename];
Export[filename, nb];
NotebookClose[nb];
DateDifference[time, DateList[], "Second"]

424.599 s

$\endgroup$
  • 1
    $\begingroup$ It took 546 seconds on my Windows 7 system with Mathematica 10.2 $\endgroup$ – Gustavo Delfino Sep 16 '15 at 18:05
  • 2
    $\begingroup$ The timings on V9 are like those on V7. It's a V10 thing $\endgroup$ – Dr. belisarius Sep 16 '15 at 18:32
  • 1
    $\begingroup$ Both tests crash Mma 10.2 on OS X 10.10.5 on the Export statement. $\endgroup$ – Chris Degnen Sep 16 '15 at 21:50
  • $\begingroup$ I'll confirm that MMA 10.2 on Win7-64 also crashes irretrievably on the Export statement (the rest of the code is executed fine and fast). $\endgroup$ – MarcoB Sep 17 '15 at 0:30
  • $\begingroup$ I got 3.2194 seconds on my Macbook Air with Mathematica 10.0.0.0. $\endgroup$ – Brian G Sep 22 '15 at 4:57
6
$\begingroup$

Wolfram support has pointed out that the problem is confined to the TextJustification, and if this is removed the page creation speeds up.

This isn't a solution if text justification is required.

$\endgroup$
  • $\begingroup$ Have they mentioned if this is going to be fixed? $\endgroup$ – shrx Mar 18 '16 at 10:36
  • $\begingroup$ I got acknowledgment that there is a problem that needs to be "identified and fixed". I'll follow up when I've tested version 10.4 (on Windows). $\endgroup$ – Chris Degnen Mar 18 '16 at 11:05
  • 1
    $\begingroup$ @shrx Fixed in Mathematica 11 I am reliably informed. $\endgroup$ – Chris Degnen Apr 29 '16 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.