Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!acorn!john From: john@acorn.co.uk (John Bowler) Newsgroups: comp.windows.x Subject: Re: X server speed Summary: Arc drawing speed Keywords: speed Message-ID: <7413@acorn.co.uk> Date: 4 Jun 91 15:22:23 GMT References: <1991May30.210439.10218@casbah.acns.nwu.edu> Organization: Acorn Computers Ltd, Cambridge, UK Lines: 51 In article <1991May30.210439.10218@casbah.acns.nwu.edu> edy@andersen.com (Edy Liongosari) writes: >I am wondering whether any body out there has done any performance testing >of X in Sun Sparc workstations. My comments are based on Acorn systems, but the principles are the same except for the strange effects which special purpose graphics cards can have on X performance. >I've tried to draw circles; each circles has radius = 100 pixels and >line width = 1. It takes about 80 sec to draw 3,600 circles using Sun Sparc 1+ >with Graphics Accelerator board (or 45 circles/sec). It matters a lot whether the line width is 0 or >0. Although the X protocol is unclear on the effect of line width on *arc* (as opposed to line) drawing the normal interpretation is that a 0 line-width arc can be drawn in an implementation dependent fashion, whereas wide line arcs (1 or greater line width) must obey the precisely specified rules in the protocol which describe which pixels to fill in. The MIT server certainly does this; so everyone else does too :-). This is particularly important for servers with graphics accelerators which support circle drawing - this circle drawing will almost certainly *not* conform to the protocol (you can't do the protocol efficiently in hardware as far as I know :-). So, to get graphics accelerator speed use 0 line-width arcs. Even in software it matters. On my server (Acorn R260, about 75% the speed of a 1+ with no accelerator?) I get 8.1 circles/sec for line width 1 and 317 circles/sec for line width 0. (gbench, diameter 100 pixels, no complex raster ops, not that it makes any difference, FillSolid). >Is there any trick to increase the performance? Yes even if using line width 0 doesn't work - the normal trick is to draw straight lines, not circles. Flatten the circle to a series of straight lines and draw them using a PolyLine (preferably with a line-width of 0, for the same reason as the arcs). You can use as many lines are you like, but normally the number chosen is such as to give 1/2 pixel or less error on any point on the circle. If you chose an algorithm with divides the circle symmetrically (eg, start with a diamond for small circles, double the number of lines until the error is small enough), the resultant ``circles'' might even *look* better than real X11 circles (it depends on how you do the rounding to pixel coordinates - round *outwards* for example with give something which is symmetrical - I haven't tried this by the way). Probably there are better ways of doing this - I have only ever seen the results rather than actually writing the code. This may sound like a lot of calculation, but it is less than that required in the server and you can cache the results if redraw speed is an issue. John Bowler (jbowler@acorn.co.uk)