MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Version 6 graphics can be painfully slow

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84865] Re: Version 6 graphics can be painfully slow
  • From: "Nasser Abbasi" <nma at 12000.org>
  • Date: Wed, 16 Jan 2008 23:09:53 -0500 (EST)
  • References: <fmkerk$72g$1@smc.vnet.net>

"Szabolcs Horvát" <szhorvat at gmail.com> wrote in message 
news:fmkerk$72g$1 at smc.vnet.net...
>
> In some cases, version 6 graphics can be painfully slow.  Consider this
> example:
>
> data = Table[{Random[], Random[]}, {100000}];
> Graphics[{PointSize[0.002], Point /@ data}, AspectRatio -> Automatic] //
> Show
>
> This used to work fine in version 5.2, but it takes forever to complete
> in version 6.0.1.  I have a dataset with about 250 000 points that I
> would like to plot, so this problem is really annoying ...
>
> The strange thing is that as soon as the graphic appears, resizing is
> fast and works fine (especially with antialiasing disabled).  So it is
> not the /drawing/ itself that takes so long.
>

Well, I think it is the rendering of the Graphics to an image format for 
display:

In[1]:= Timing[data = Table[{Random[], Random[]}, {100000}]][[1]]
Out[1]= 0.032


In[2]:= Timing[p = Graphics[{PointSize[0.002], Point /@ data}, 
AspectRatio -> Automatic]][[1]]
Out[2]= 0.062


In[3]:= t0 = TimeUsed[];
Show[p]
TimeUsed[] - t0

24.016

So it took 24 seconds to display the thing. But took fractions of second to 
compute it.

It seems the "problem" is in the rendering by the Front End. i.e. by 
converting the Graphics data structure to an image format. Or may be the FE 
was waiting for the kernel, but Show[] should be all in the FE, so my guess 
is the rendering part, or allocation of resources to render it is the 
problem.  For example, if I export the Graphics to an image file, I get the 
same delay

In[15]:= t0 = TimeUsed[];
Export["t.png", p]
TimeUsed[] - t0

Out[17]= 23.75

May be the FE tells the kernel to convert the Graphics to image format and 
the Kernel sends the image back to FE to display it, and so it could be the 
kernel at fault also. Do not know details of the protocol.

> I really hope that these problems will be fixed in 6.1, but until then,
> does anyone have a suggestion for speeding this up?
>
> (At the moment I temporarily switch back to << Version5`Graphics`)
>
> Szabolcs
>

Nasser 



  • Prev by Date: Re: Creating a Legend with ListPlot using PlotMarkers
  • Next by Date: Re: NIntegrate HypergeometricU
  • Previous by thread: Re: Version 6 graphics can be painfully slow
  • Next by thread: Re: Version 6 graphics can be painfully slow