edy@andersen.com (Edy Liongosari) (05/31/91)
I am wondering whether any body out there has done any performance testing of X in Sun Sparc workstations. 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). Is there any trick to increase the performance? Thanks in advance -Edy
michael@xzaphod.uucp (Michael R. Miller) (06/02/91)
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. > >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). > >Is there any trick to increase the performance? > >Thanks in advance >-Edy Try drawing the circle once into a bitmap or pixmap and then XCopyArea the offscreen circle to your onscreen location. If the color is the same, a pixmap might be better. If the circles overlap, you can use a bitmap and do some kind of stippling operation (perhaps GXcopy or GXor?) of the bits onto the screen. If you use stippling or tiling, try setting up between 8 and 32 different pixmaps each with it's own GC all set up and ready to use. Then decide which GC to use based upon how your x coordinate modulo {8 or 32} would select a GC (build an N entry table of GCs each with its tile/stipple offset 1 pixel greater than the previous). Your area stippled/tiled is equal to the size of the bitmap/pixmap. Stippling will allow you to use different colors (make sure you set the current foreground in the GC before you draw). Stippling will be slower than tiling because your GC must be re-validated every time you change the FG value. A good server will detect that the stipple rotation didn't change and won't go thru the effort of redoing the origin of the stipple bitmap. But that's a good server. Tiling is the best but most restrictive. Tiling can get you bitblt speeds which should be significantly faster than 45 circles/second. A plain old XCopyArea will be somewhat slower as the server will have to line up the source and destination but you should still do quite well with that. Stippling will probably fall in between the two in speed and much of that performance will be dependent upon the quality of the GC validation routine and the characteristics of your application (ie. how many times you must change the FG value in your GCs). Good luck. Michael R. Miller uunet!xzaphod!michael
john@acorn.co.uk (John Bowler) (06/04/91)
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)
rws@expo.lcs.mit.EDU (Bob Scheifler) (06/05/91)
Although the X protocol is unclear on the effect of line width on *arc* (as opposed to line) drawing Although there are some ambiguities, for the most part the effect is rather clear, some would say too clear. 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 :-). You obviously haven't done your homework. Pixelating the boundaries of wide circles is not a problem. The problem is pixelating the boundaries of wide ellipses. 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). You poor thing. :-) On a lowly Sun 3/60 with an 8-bit frame buffer, I can get about 200 such circles per second for line width 1. Probably there are better ways of doing this Yes, use a little math. :-)