Jump to content

XControl Performance


mje

Recommended Posts

I took my first plunge into XControls a while ago with a proof of principle of some functionality I'd like to implement in one of my applications, and I'm curious to hear from those of you who have more experience with them than I.

My XControl is basically a single 2D Picture, with a some rendering logic attached to it. In the end, it generates a decent size image (usually in the neighborhood of 5-10 MP), and has tracking logic to translate location to rendered features.

Obviously I'm only showing a subset of the image at any one time. I found the easiest way to do so is just to play with the Picture.Origin properties of the control, or alternatively just show the picture's scrollbars. The problem is both of these are hideously slow in the XControl, when operating on the picture I'm lucky to get more than 2 or 3 frames per second.

In another test, I borrowed the rendering logic of my XControl, and used it to render into a picture control in a normal VI, then tried handling the same mouse tracking algorithms in the VI's own loop+event structure and it works pretty slick, moving the picture around is very smooth.

So the question is, is there something about an XControl implementation that is fundamentally slower than just kludging together all the pieces in a "normal" VI? I really like the XControl encapsulation, but if it comes at the expense of performance, I'll take kludgy over encapsulated any day. I keep looking at the XControl trying to find something that will slow things down, but I admittedly still don't really understand what's going on under the hood of XControls, so I think I'm fighting a loosing battle on that front.

Sorry, I can't post the XControl logic. I'm just curious what others experiences are.

Link to comment

Ah, found a flaw in both my test and the xcontrol.

Basically, the xcontrol was hanging onto the raw picture data, which is a bunch of non-rendered opcodes. The test was using a pre-rendered bitmap. It seems moving an image around is far more efficient if it's a "flat" bitmap. Add in this little ditty before dumping the image into the picture control and things work quite well.

post-11742-0-15370600-1332429068.png

Ok, I'm back on the XControl bandwagon.

Link to comment

That's interesting. Though both my xcontrol and native ui tests now render reasonably quickly now, the xcontrol is considerably laggier. I wonder if it's the two UI queues competing for processing.

Might be best if I stick with the devil I know...

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.