Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!sdd.hp.com!elroy.jpl.nasa.gov!jarthur!uunet!mcsun!ukc!tcdcs!swift.cs.tcd.ie!maths.tcd.ie!jorice From: jorice@maths.tcd.ie (Jonathan Rice) Newsgroups: comp.windows.x Subject: Re: XPutImage() vs XDrawPoint() performance. Message-ID: <1990Jul16.113655.28955@maths.tcd.ie> Date: 16 Jul 90 11:36:55 GMT References: <26024@pasteur.Berkeley.EDU> <890047@hpfcdq.HP.COM> Organization: Dept. of Maths, Trinity College, Dublin, Ireland. Lines: 45 >> If I want to draw billions of points on an in-memory image (not displayed), >> which of these two calls would be faster? In <890047@hpfcdq.HP.COM> elliott@hpfcdq.HP.COM (Ian Elliott) writes: >I would suggest using neither. Use XDrawPoints, which will give you >better network/IPC bandwidth/performance. If you don't want to or can't >do that, I'd suggest XDrawPoint simply because there is less protocol >data and the primitive is normally quite fast (or should be). As I see it, this discussion should start with asking "What sort of picture do you want to draw?" and "In what way does your algorithm produce the points that it wants to plot?" I can't see that one can give an absolute answer to the original question - you have to see which method suits the program. To give an example, say that what you want to completely fill an image with points of a random colour - noise, essentially. The easiest way to do this is to fill an XImage with random values in scanline order on the client side and then whack it into a Pixmap or window on the server with XPutImage. It would be a very bad idea to use XDrawPoints in this case because each call plots in a single colour. If you are proceeding along scanlines drawing the image, you'd have to change the plotting colour for almost every pixel, for the case I've described, so you'd have to issue a separate plotting command for each pixel. That's a lot of protocol. And if you use XDrawPoints() more efficiently, by trying to draw all like-coloured points in the image on each call, then you'll probably run into problems in my example keeping track of just which pixels you have plotted and which you haven't. For this example, some sort of scanline-order plotting with rapid colour changing is the obvious solution. This just isn't suited to the same-colour, coordinate-based operation of XDrawPoints(). To give a counter-example, the best case for XDrawPoints() would be, say, in drawing star maps, where you might only have a dozen different colours of stars and you want to draw all the whites, then all the reds, etc. It'd be inefficient to use XPutImage() in this case, because most of the XImage you'd be transferring to the server would be empty. All this seems sensible to me, anyway, but no, I haven't done any tests. -- Jonathan o----------------------o----------------------------o--------------------------o | Jonathan Rice | Email: jorice@cs.tcd.ie | He was a common fly | |----------------------| Tel: 353.1.772941 x2156 (w)| With a taste for fashion | |Computer Science Dept.| 353.1.6245415 (h)| They were thrown together| | Trinity College | Fax: 353.1.772204 | In a heat of passion | | Dublin 2, | woof /\___/ | - "Human Fly", | | Ireland. | /| |\ | The Horseflies | o----------------------o----------------------------o--------------------------o