it's known to all that ,sometimes higher version is far more slow than low version

this is a example.

Clear["Global`*"]; Plot[Sin[x], {x, 0, 5}] // AbsoluteTiming

on my computer

enter image description here

enter image description here

So is there a way to use low version in high version?

The reason why I don't use low version directly is that high version has more functions,which is more convenient.

thx to the link in the comment.I find this.


  • 2
    $\begingroup$ No, not possible $\endgroup$
    – b3m2a1
    Jan 8, 2020 at 7:37
  • 3
    $\begingroup$ Related: mathematica.stackexchange.com/q/209225/1871 $\endgroup$
    – xzczd
    Jan 8, 2020 at 11:17
  • $\begingroup$ @b3m2a1 actually it did work. $\endgroup$ Jan 8, 2020 at 11:40
  • $\begingroup$ @wuyudi you’re not using the functions in the old version in the new one, but rather calling into the old one in the new one. That’s gonna introduce calling overhead that will obliterate the performance gain that motivated your question in the first place. $\endgroup$
    – b3m2a1
    Jan 8, 2020 at 17:02

2 Answers 2


Yes, it's possible with Graphics`Legacy`Plot:

enter image description here

Update in respond to comment about 3D:

First, @Jens's webpage has some discussion of graphics changes in V5, 6, 7, and 8. It has not been updated since 2012, but for its historical interest, it seems relevant to this Q&A. In particular, the package "Graphics`Graphics3D`" no longer exists AFAICT. You can still override the current plotters with << Version5`Graphics`. (I think you have to quit the kernel to restore them. There's also a "Version6`Graphics`" package to restore V6 graphics. These mainly exist, it seems, to provide some backwards compatibility with old notebooks.)

The legacy 3D plotters produce SurfaceGraphics[..] instead of Graphics3D[..]. There's not much point, other than historical interest, but here's a way to convert them to Graphics3D objects, with different styling. The conversion pretty much takes away any speed gain, so it's pointless as far as that goes.

SurfaceGraphicsToGraphics3D = # /. 
    SurfaceGraphics[data_, opts_] :>
      DataRange -> OptionValue[SurfaceGraphics, opts, MeshRange], 
      FilterRules[opts, Options@ListPlot3D]] &;

  Sin[x y], {x, 0, 5}, {y, 0, 5}] // AbsoluteTiming
Graphics`Legacy`Plot3D[Sin[x y], {x, 0, 5}, {y, 0, 5}] // 
  SurfaceGraphicsToGraphics3D // AbsoluteTiming

enter image description here

Using Visualization`Core`ListPlot3D saves about half the time over ListPlot3D. ListPlot3D, like other plotters, does some preprocessing before calling its internal version Visualization`Core`ListPlot3D. You probably lose some functionality and safeguards bypassing the top level ListPlot3D, but maybe it's worth it to you. Once upon a time, I'd do things in graphics directly and bypass plotters, but computers are pretty fast now. A plot that is too slow is usually due to the function, not to the plotter. Sometimes in Manipulate a tenth of a second can make a difference in the user experience, so to manipulate a fixed example, it might make sense to bypass Plot3D, which takes about a tenth of a second on the example below. Here's a pretty dumb 3D plotter, similar to the legacy one, with only one option implemented:

SetAttributes[plot3D, HoldAll];
plot3D[f_, {x_, x1_, x2_}, {y_, y1_, y2_}, 
   opts : OptionsPattern[Plot3D]] :=
  With[{pp = OptionValue[PlotPoints] /. Automatic -> 25},
   With[{data = Flatten[
       Table[{x, y, f}, {x, Subdivide[N@x1, N@x2, pp - 1]}, {y, 
         Subdivide[N@y1, N@y2, pp - 1]}],
      (Flatten /@ Flatten[
           Partition[Partition[Range@Length@data, pp], {2, 2}, {1, 1}],
           1])[[All, {1, 2, 4, 3}]] // Polygon
      ], FilterRules[{opts}~Join~Options@Plot3D, Options@Graphics3D]]

plot3D[Sin[x y], {x, 0, 5}, {y, 0, 5}] // AbsoluteTiming

enter image description here

  • $\begingroup$ Unfortunately it will crashed inside Table or Manipulate.For example: Table[Graphics`Legacy`Plot[ Sin[x + a], {x, 0, 2 Pi}], {a, 1, 5}] $\endgroup$
    – matrix42
    Jan 9, 2020 at 4:41
  • $\begingroup$ it seems that this function has a little problem. But it is really fast. Graphics`Legacy`Plot[Tan[x], {x, 0, Pi}] $\endgroup$ Jan 9, 2020 at 8:08
  • $\begingroup$ ok,I find this. Visualization`Core`Plot3D[Sin[x y], {x, 0, 5}, {y, 0, 5}] ,which can draw 3D $\endgroup$ Jan 9, 2020 at 8:18
  • $\begingroup$ @matrix89 Try it thus: Table[With[{a = a}, Graphics`Legacy`Plot[Sin[a x], {x, 0, 5}]], {a, 2}] $\endgroup$
    – Michael E2
    Jan 9, 2020 at 12:51
  • 1
    $\begingroup$ @wuyudi Do you mean the "little problem" is the extra vertical line in Graphics`Legacy`Plot[Tan[x], {x, 0, Pi}] compared to Plot[Tan[x], {x, 0, Pi}]? One reason the new Plot is slower than the legacy Plot is that it does extra analysis to exclude discontinuities as well as other preprocessing (plot themes, Quantity[], etc.); the new plotters also do better adaptive refinement, too. -- Note that Visualization`Core`Plot3D is pretty much the same as Plot3D minus the automatic option processing. To get closer to the legacy function add the option MaxRecursion -> 0. $\endgroup$
    – Michael E2
    Jan 9, 2020 at 14:05

I find this link. And change a little.


here is the code.

SetAttributes[linkEvaluate, HoldRest]
linkEvaluate[link_LinkObject, expr_] := 
  Catch[Module[{out = {}, postScript = {}, packet, outputs = {}}, 
     Print["From the buffer:\t", LinkRead[link]]];
    LinkWrite[link, Unevaluated[EnterExpressionPacket[expr]]];
    While[Not@MatchQ[packet = LinkRead[link], InputNamePacket[_]], 
     Switch[packet, DisplayPacket[_], 
      AppendTo[postScript, First@packet], DisplayEndPacket[_], 
      AppendTo[postScript, First@packet];
         Cell[GraphicsData["PostScript", #], "Output", 
          CellLabel -> "Kernel 5.2 PostScript ="] &@
       StringJoin[postScript]; postScript = {}, TextPacket[_], 
        WordCharacter .. ~~ "::" ~~ WordCharacter .. ~~ ": " ~~ __], 
          RowBox[{StyleBox["Kernel 5.2 Message = ", 
             FontColor -> Blue], First@packet}], "Message"], 
        Cell[First@packet, "Output", 
         CellLabel -> "Kernel 5.2 Print"]], OutputNamePacket[_], 
      AppendTo[outputs, First@packet];, ReturnExpressionPacket[_], 
      AppendTo[outputs, First@packet];, _, AppendTo[out, packet]]];
    If[Length[out] > 0, Print[out]];
    Which[(l = Length[outputs]) == 0, Null, l == 2, Last@outputs, 
     True, multipleOutput[outputs]]]];
SetAttributes[kernel8Evaluate, HoldAll]
kernel8Evaluate[expr_] := 
 If[TrueQ[MemberQ[Links[], $kern8]], linkEvaluate[$kern8, expr], 
  Clear[$kern8]; $kern8 = 
    "C:\\Program Files\\Wolfram \
Research\\Mathematica\\8.0\\MathKernel.exe -mathlink"];(*the address of your MathKernel*)
   Unevaluated[EnterExpressionPacket[$MessagePrePrint = InputForm;]]];
  LinkRead[$kern8]; kernel8Evaluate[expr]]

and here is the result.

enter image description here

  • 3
    $\begingroup$ How useful is this to deal with the performance problem you described? The overhead of calling another kernel process may be significant. Also, definitions will not be shared between the kernels, which limits the usefulness of this approach. $\endgroup$
    – Szabolcs
    Jan 8, 2020 at 12:12
  • $\begingroup$ @SzabolcsSz well,it is really sort of useless.But this really happens: some question that new version is short to solve while old version is able to solve. $\endgroup$ Jan 8, 2020 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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