[Xcircuit-dev] xcircuit rendering speed

Tim Edwards tim at opencircuitdesign.com
Mon Mar 12 14:09:41 PDT 2012


Hello Dimitri,

> Any hints on how to improve rendering speed with XCircuit? I've tried
> to profile xcircuit using <sys/time.h>, to discover most of the draw
> time is spend in functions.c::void void strokepath(XPoint *pathlist,
> short number, short style, float width). However using cachegrind
> there is a clear indicator that most time is spend servicing tk.
> I've figured out every drawing operation is done by calls to Xlib,
> (the opengl code seems to be incomplete, i've got it to compile, but
> it doesn't run properly, only tkcon pops up).
> The attachment is the reason I would like XCircuit to render a bit
> faster, the flexibility of XCircuit allows me to plan the breadboards
> i'm developing (lots of polygon instances).

I expect that the mailman application stripped the attachment off of
your email---can you please send it to me directly?  Thanks.

> I am however not quite at home in Xlib or opengl, so I wonder, is the
> renderingspeed fixable in XCircuit (slowness of tk events?) or is it
> limited by the speed of XLib? Any general direction would be great!

I worked a while at getting the OpenGL rendering working before
eventually abandoning it because OpenGL just won't do basic line
drawing operations.  Every single line would have to be drawn using
polygons and polygon approximations, and corners at line angles and
round endcaps have to all be calculated out geometrically, which is
a royal pain.  But I'm surprised that you can only get a Tk window
up.  I can get the OpenGL rendering, and it looks fantastic, except
that a lot of things either don't render correctly or don't refresh
correctly, because I didn't spend the time to fix them.

But for your main question, the main reason that XCircuit doesn't
render fast is because I have never really run across a situation
where rendering speed was an issue, so I have not done much in the
way of rendering optimization.  To me, everything renders
instantly compared to, say, a large layout in magic.  Tk call
servicing should not be an issue for rendering;  indeed, it will
spend a lot of time on Tk calls, but these are housekeeping duties
and do not interrupt the drawing.  Since the drawing is done by X11,
the rendering speed will be highly dependent on your graphics card
and what support it has in xorg or whatever driver you have for it.
I use nVidia cards generally, and use the nVidia drivers, and these
have good hardware acceleration (although I have yet to try your
torture test).

The most obvious rendering speed-up would be to flag, for every
operation, the area potentially affected, and restrict the re-rendering
to that area, while updating non-affected areas by a simple pixmap-to-
pixmap copy.  There are numerous places in the code that I didn't bother
with any finesse, but just wipe and redraw the whole screen.  Under
normal circumstances, this happens so fast that it's not noticeable.

							---Tim

+--------------------------------+-------------------------------------+
| Dr. R. Timothy Edwards (Tim)   | email: tim at opencircuitdesign.com    |
| Open Circuit Design, Inc.      | web:   http://opencircuitdesign.com |
| 22815 Timber Creek Lane        | phone: (301) 528-5030               |
| Clarksburg, MD 20871-4001      | cell:  (240) 401-0616               |
+--------------------------------+-------------------------------------+


More information about the Xcircuit-dev mailing list